home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-1.iso / comm / tm420_1.zip / TMSCRIPT.TXT < prev    next >
Text File  |  1995-06-14  |  160KB  |  4,592 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.      ▌███████████ ▌█████████▌  ▌██████                 ▌█             ▌█
  14.           ▌█▌     ▌█▌ ▌█▌ ▌█▌  ▌█▌                                    ▌█
  15.           ▌█▌     ▌█▌ ▌█▌ ▌█▌  ▌█▌      ▌████▌  ▌████  ▌█   ▌██████ ▌█████
  16.           ▌█▌     ▌█▌ ▌█▌ ▌█▌  ▌██████  ▌█      ▌█     ▌█   ▌█   ▌█   ▌█
  17.           ▌█▌     ▌█▌ ▌█▌ ▌█▌       ▌█  ▌█      ▌█     ▌█   ▌█   ▌█   ▌█
  18.           ▌█▌     ▌█▌ ▌█▌ ▌█▌       ▌█  ▌█      ▌█     ▌█   ▌█   ▌█   ▌█
  19.           ▌█▌     ▌█▌ ▌█▌ ▌█▌  ▌██████  ▌████▌  ▌█     ▌█   ▌██████   ▌███
  20.                                                             ▌█
  21.                                                             ▌█
  22.                                                             ▌█
  23.  
  24.  
  25.  
  26.  
  27.                            Telemate Script Language
  28.  
  29.                                  Version 4.20
  30.  
  31.  
  32.  
  33.                       By  Tsung Hu, White River Software
  34.  
  35.  
  36.  
  37.  
  38.  
  39.                  Copyright (c) 1988-1995 White River Software.
  40.  
  41.                               All rights reserved.
  42.  
  43.  
  44. TELEMATE SCRIPT                                     TABLE OF CONTENTS    i
  45.  
  46. TABLE OF CONTENTS
  47.  
  48. INTRODUCTION                                                             1
  49.     Using TMS.EXE, the Script Compiler  . . . . . . . . . . . . . . . .  1
  50.     To Run a Script . . . . . . . . . . . . . . . . . . . . . . . . . .  2
  51.     What Is Your Name . . . . . . . . . . . . . . . . . . . . . . . . .  2
  52.  
  53. DATA TYPES                                                               3
  54.     Integer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  3
  55.     String  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  3
  56.     Character . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  3
  57.     Boolean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  4
  58.     Date  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  4
  59.     Time  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  5
  60.  
  61. VARIABLES                                                                6
  62.     Variable Identifiers  . . . . . . . . . . . . . . . . . . . . . . .  6
  63.     Variable Declarations . . . . . . . . . . . . . . . . . . . . . . .  6
  64.     Predefined Variables  . . . . . . . . . . . . . . . . . . . . . . .  6
  65.        CONNECTED  . . . . . . . . . . . . . . . . . . . . . . . . . . .  7
  66.        FOUND  . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  8
  67.        SUCCESS  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  8
  68.        LOGGING  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  9
  69.        WIDTH  . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  9
  70.        HEIGHT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
  71.  
  72. EXPRESSIONS                                                             11
  73.     Rule Of Precedence  . . . . . . . . . . . . . . . . . . . . . . . . 11
  74.     Arithmetic Operators  . . . . . . . . . . . . . . . . . . . . . . . 11
  75.     Boolean Operators . . . . . . . . . . . . . . . . . . . . . . . . . 12
  76.     Relational Operators  . . . . . . . . . . . . . . . . . . . . . . . 12
  77.  
  78. STATEMENTS                                                              14
  79.     Comment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
  80.     Assignment Statement  . . . . . . . . . . . . . . . . . . . . . . . 14
  81.     If Statement  . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
  82.     Switch Statement  . . . . . . . . . . . . . . . . . . . . . . . . . 16
  83.     While Loop  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
  84.     Repeat Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
  85.     Exit Statement  . . . . . . . . . . . . . . . . . . . . . . . . . . 18
  86.     #include Directive  . . . . . . . . . . . . . . . . . . . . . . . . 18
  87.  
  88. PROCEDURES                                                              19
  89.     Procedure Declaration . . . . . . . . . . . . . . . . . . . . . . . 19
  90.     Parameter Declaration . . . . . . . . . . . . . . . . . . . . . . . 20
  91.     Calling Procedure and Parameter Passing . . . . . . . . . . . . . . 20
  92.     Nested Procedures and Scope of Variables  . . . . . . . . . . . . . 22
  93.     Return Statement  . . . . . . . . . . . . . . . . . . . . . . . . . 23
  94.  
  95.  
  96. TELEMATE SCRIPT                                    TABLE OF CONTENTS    ii
  97.  
  98.  
  99. BUILT IN PROCEDURES BY CATEGORY                                         24
  100.     Console I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
  101.        Print Statement  . . . . . . . . . . . . . . . . . . . . . . . . 24
  102.     COM I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
  103.        Put Statement  . . . . . . . . . . . . . . . . . . . . . . . . . 25
  104.        Waitfor Statement  . . . . . . . . . . . . . . . . . . . . . . . 25
  105.     File Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
  106.     String Handling . . . . . . . . . . . . . . . . . . . . . . . . . . 26
  107.     Miscellaneous Routines  . . . . . . . . . . . . . . . . . . . . . . 26
  108.  
  109. BUILT IN PROCEDURES                                                     27
  110.     Alarm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
  111.     Append  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
  112.     At  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
  113.     Atoi  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
  114.     ChDir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
  115.     Clear COM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
  116.     Clear Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
  117.     Clear Text  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
  118.     Close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
  119.     ComInCount  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
  120.     ComOutCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
  121.     Concat  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
  122.     Create  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
  123.     Date  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
  124.     Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
  125.     Delete  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
  126.     Dial  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
  127.     Dos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
  128.     ExitTelemate  . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
  129.     FileExist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
  130.     FileSize  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
  131.     Get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
  132.     GetCh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
  133.     HangUp  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
  134.     Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
  135.     Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
  136.     InputCh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
  137.     Itoa  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
  138.     Keystroke . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
  139.     Length  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
  140.     LoadFon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
  141.     LoadKey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
  142.     LoadMac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
  143.     LoadPad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
  144.     LogOff  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
  145.     LogOn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
  146.     LogPause  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
  147.     LogResume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
  148.     Open  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
  149.     Print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
  150.  
  151. TELEMATE SCRIPT                                   TABLE OF CONTENTS    iii
  152.  
  153.  
  154.     Put . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
  155.     Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
  156.     Read  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
  157.     ReadCh  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
  158.     Receive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
  159.     Rename  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
  160.     Script  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
  161.     Seek  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
  162.     Send  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
  163.     Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
  164.     Stop  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
  165.     StrDel  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
  166.     StrIns  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
  167.     StrPos  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
  168.     StrSet  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
  169.     SubStr  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
  170.     Tell  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
  171.     Time  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
  172.     Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
  173.     Waitfor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
  174.     WaitUntil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
  175.     When  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
  176.     WhenIdle  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
  177.     WhereX  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
  178.     WhereY  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
  179.     Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
  180.  
  181. TOOLBOX PROCEDURES                                                      65
  182.     Toolbox #1                                                          65
  183.        Color Values and ANSI Color Codes  . . . . . . . . . . . . . . . 66
  184.        EchoToLocal and EchoToRemote . . . . . . . . . . . . . . . . . . 66
  185.        Echo and EchoInt . . . . . . . . . . . . . . . . . . . . . . . . 66
  186.        EchoBkColor  . . . . . . . . . . . . . . . . . . . . . . . . . . 67
  187.        EchoBlink  . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
  188.        EchoBlock  . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
  189.        EchoBox  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
  190.        EchoClearScreen  . . . . . . . . . . . . . . . . . . . . . . . . 69
  191.        EchoColor  . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
  192.        EchoGotoXY . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
  193.        EchoHiLite . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
  194.        EchoNormal . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
  195.        EchoReverse  . . . . . . . . . . . . . . . . . . . . . . . . . . 71
  196.     Toolbox #2                                                          72
  197.        GetN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
  198.        InputN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
  199.        ReadN  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
  200.        isalpha  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
  201.        isalnum  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
  202.        iscntl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
  203.        isdigit  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
  204.  
  205. TELEMATE SCRIPT                                    TABLE OF CONTENTS    iv
  206.  
  207.  
  208.     Toolbox #3                                                          75
  209.        ConvertDate  . . . . . . . . . . . . . . . . . . . . . . . . . . 75
  210.        DiffDate . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
  211.        DiffTime . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
  212.        PhoneDirectory . . . . . . . . . . . . . . . . . . . . . . . . . 78
  213.        PhoneFind  . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
  214.        PhoneRead  . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
  215.        PhoneSize  . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
  216.        PhoneWrite . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
  217.  
  218. APPENDIX A: ERROR MESSAGES                                              81
  219.     Compiler Error Messages . . . . . . . . . . . . . . . . . . . . . . 81
  220.     Runtime Error Messages  . . . . . . . . . . . . . . . . . . . . . . 83
  221.  
  222. INDEX                                                                   84
  223.  
  224. TELEMATE SCRIPT                                          INTRODUCTION    1
  225.  
  226.  
  227. INTRODUCTION
  228. ──────────────────────────────────────────────────────────────────────────
  229.  
  230.     TMScript allows you to write procedures to perform repetitive
  231.     functions, such as a log on script, as well as specific applications,
  232.     such as the host mode.
  233.  
  234.     TMScript is designed to be a easy-to-use language. TMScript looks
  235.     similar to the Pascal language and the syntax is as loose as that of
  236.     BASIC language. For most of the users, only the WAITFOR, PUT and maybe
  237.     the WHEN statements are necessary. For those users who have experience
  238.     in the other programming language, TMScript is a powerful tool for
  239.     communication related application.
  240.  
  241.     A script file can be created using almost all editors. The source file
  242.     is a normal ASCII text file which contains a sequence of instructions
  243.     telling Telemate what to perform next. The source file should use the
  244.     extension .SCR to indicate that it is a SCRipt file.
  245.  
  246.  
  247. Using TMS.EXE, the Script Compiler
  248. ──────────────────────────────────────────────────────────────────────────
  249.  
  250.     Once the source file is written, it must be compiled (translated) to a
  251.     form that Telemate can load and interpret quickly. To compile a source
  252.     file, type
  253.  
  254.          TMS [/d] filename
  255.  
  256.     where <filename> is the filename of the source file. The extension can
  257.     be omitted if it is .SCR. TMS.EXE compiles the file 'filename.SCR' and
  258.     produces the compiled script file 'filename.TMS'. For example, typing
  259.     'TMS \TM\HOST', TMS compiles '\TM\HOST.SCR' and produces
  260.     '\TM\HOST.TMS'.
  261.  
  262.     If a syntax error is encountered in the source file, the compiler
  263.     reports the line number and the type of the error. You should edit the
  264.     source file and recompile until there is no more errors.
  265.  
  266.     If the optional /d parameter is specified, the compiler will consider
  267.     undeclared variable as an error. This option can be used when writing
  268.     larger script and you want to ensure you declare all the variables and
  269.     to avoid spelling mistake on the variable name.
  270.  
  271.  
  272.  
  273. TELEMATE SCRIPT                                          INTRODUCTION    2
  274.  
  275.  
  276. To Run a Script
  277. ──────────────────────────────────────────────────────────────────────────
  278.  
  279.     There are several ways to run a script.
  280.  
  281.     1. Pressing [Alt S] at the Terminal Window opens the File Dialog and
  282.        you are asked to identify which script file to be executed.
  283.  
  284.     2. Put the script name in the link-script field of the phone
  285.        directory. When the BBS is connected, the link-script is executed
  286.        automatically. Link-scripts are sometimes referred as logon scripts
  287.        because they perform repetitive logon procedure.
  288.  
  289.     3. Type 'TM <scriptname>' at the DOS command line. For example,
  290.          C>TM HOST
  291.        put Telemate in host mode when start.
  292.  
  293.     4. You may assign a function key to execute a script file using the
  294.        "^\" macro sequence. For example, the function key [Alt 4] is
  295.        "^\host", when you press [Alt 4], the host script will be executed.
  296.  
  297.     5. The SCRIPT statement allows you run another script in a script
  298.        program. Please refer the description of the SCRIPT statement.
  299.  
  300.  
  301. What Is Your Name
  302. ──────────────────────────────────────────────────────────────────────────
  303.  
  304.     The first example program is a simple logon script. It waits for the
  305.     logon prompts and sends the response to the remote system.
  306.  
  307.          WAITFOR "What is your name?"; wait for the logon prompt
  308.          PUT "my name"               ; send your name to remote system
  309.          WAITFOR "is your password?" ; wait for the password prompt
  310.          PUT "my password"           ; send your name to remote system
  311.  
  312.     A script can be as simple as that and it will help you to logon to the
  313.     remote system automatically.
  314.  
  315. TELEMATE SCRIPT                                            DATA TYPES    3
  316.  
  317.  
  318. DATA TYPES
  319. ──────────────────────────────────────────────────────────────────────────
  320.  
  321.     TMScript provides two basic data types, integer and string, and four
  322.     extended data types, character, boolean, date and time.
  323.  
  324.  
  325. Integer
  326. ──────────────────────────────────────────────────────────────────────────
  327.  
  328.     Ordinary number notation is used for integers. Decimal and engineering
  329.     notation (e or E followed by an exponent) is not supported. Integer
  330.     must within the range from -2147483648 to 2147483647.
  331.  
  332.  
  333. String
  334. ──────────────────────────────────────────────────────────────────────────
  335.  
  336.     A string is a sequence of zero or more characters from extended ASCII
  337.     character set (0-255), enclosed by quotation marks. A string with
  338.     nothing in it is called a empty string. Two sequential quotation marks
  339.     in a string denote a single character, an quotation mark.
  340.  
  341.     TMScript allows control characters to be embedded in strings. The '^'
  342.     character followed by a letter (A-Z, a-z), '@' or '[' denotes a
  343.     character of the ASCII code [Ctrl A] to [Ctrl Z], NULL, or ESC
  344.     respective.
  345.  
  346.     Here are some examples of strings
  347.  
  348.          "TELEMATE"
  349.          "This is a '""'."
  350.          "^K^D"              ; [Ctrl K] [Ctrl D]
  351.  
  352.  
  353. Character
  354. ──────────────────────────────────────────────────────────────────────────
  355.  
  356.     Character is represented as a string that contains only one character.
  357.     For example, "A" is a character. Control codes are often used in
  358.     script programs and are represented as
  359.  
  360.          Code   String Description
  361.          ────── ────── ───────────────
  362.          Ctrl-@  "^@"  NULL
  363.          Ctrl-A  "^A"
  364.           ...     ..
  365.          Ctrl-H  "^H"  Backspace
  366.          Ctrl-I  "^I"  TAB
  367.          Ctrl-J  "^J"  LF, line feed
  368.           ...     ..
  369.  
  370. TELEMATE SCRIPT                                            DATA TYPES    4
  371.  
  372.  
  373.          Ctrl-M  "^M"  CR, Carriage Return, [Enter]
  374.           ...     ..
  375.          Ctrl-Z  "^Z"
  376.          Ctrl-[  "^["  Escape
  377.  
  378.  
  379. Boolean
  380. ──────────────────────────────────────────────────────────────────────────
  381.  
  382.     Boolean (TRUE or FALSE) is represented as a integer. A integer is said
  383.     to be TRUE if it is not equal to zero, FALSE if it is equal to zero.
  384.     When testing a boolean condition, you should not use the following
  385.     code,
  386.  
  387.          IF CONNECTED=1
  388.             ...
  389.          ENDIF
  390.  
  391.     because the variable CONNECTED may have other values. Instead, you
  392.     should use
  393.  
  394.          IF CONNECTED
  395.             ...
  396.          ENDIF
  397.  
  398.     to test if CONNECTED is TRUE. And
  399.  
  400.          IF NOT CONNECTED
  401.             ...
  402.          ENDIF
  403.  
  404.     to test if CONNECTED is FALSE.
  405.  
  406.  
  407. Date
  408. ──────────────────────────────────────────────────────────────────────────
  409.  
  410.     Date is represented as a string with the format "MM-DD-YY". When a
  411.     date string is compared with another date string, they are first
  412.     converted to the internal format "YYMMDD" so that the comparison
  413.     returns the correct result.
  414.  
  415.     Note that the date format option in the main program does not affect
  416.     the format in the script. For date conversion, see ConvertDate command
  417.     in toolbox #3.
  418.  
  419.  
  420.  
  421. TELEMATE SCRIPT                                            DATA TYPES    5
  422.  
  423.  
  424. Time
  425. ──────────────────────────────────────────────────────────────────────────
  426.  
  427.     Time is also represented as a string but with the format "HH:MM:SS".
  428.     When two time strings are being compared, they are converted to the
  429.     internal format "HHMMSS" such that the comparison can the correct
  430.     result.
  431.  
  432.  
  433.  
  434. TELEMATE SCRIPT                                             VARIABLES    6
  435.  
  436.  
  437. VARIABLES
  438. ──────────────────────────────────────────────────────────────────────────
  439.  
  440. Variable Identifiers
  441. ──────────────────────────────────────────────────────────────────────────
  442.  
  443.     A variable identifier can contain letters and digits. However, a
  444.     variable can only start with a letter. Case is not significant, in the
  445.     other word, the variable <notdone> is the same as <NotDone>. A
  446.     variable identifier can be of any length, but only the first 8
  447.     characters are significant.  For examples, the variable identifier
  448.     <Number12> is the same as <Number123>.
  449.  
  450.  
  451. Variable Declarations
  452. ──────────────────────────────────────────────────────────────────────────
  453.  
  454.     A variable declaration embodies a list of identifiers that designate
  455.     new variables and their type. For example,
  456.  
  457.          INTEGER lower,upper,step    ; integers
  458.          STRING  message,filename    ; strings
  459.          INTEGER true,false          ; boolean
  460.          STRING  ch,letter           ; character
  461.  
  462.     The variable declaration part should be placed at the beginning of a
  463.     script or of a procedure. In TMScript, variables need not declared
  464.     before use if no procedure is defined. Therefore, the variable
  465.     declaration part can be skipped.
  466.  
  467.  
  468. Predefined Variables
  469. ──────────────────────────────────────────────────────────────────────────
  470.  
  471.     TMScript built in procedures do not return value. Several predefined
  472.     variables are set to the resulting value. They are CONNECTED, FOUND,
  473.     SUCCESS, LOGGING, WIDTH and HEIGHT.
  474.  
  475.  
  476.  
  477. TELEMATE SCRIPT                                             VARIABLES    7
  478.  
  479.  
  480. CONNECTED
  481.  
  482.     CONNECTED is set to the number of the connected entry (from 1 to
  483.     1000). The variable CONNECTED returns to FALSE as soon as the carrier
  484.     lost. On the other hand, if the state of the carrier changes from OFF
  485.     to ON, CONNECTED is set to TRUE.
  486.  
  487.          IF NOT CONNECTED
  488.             PRINT "It is not connected to a remote system."
  489.             STOP
  490.          ENDIF
  491.          SWITCH CONNECTED
  492.            CASE 1: PRINT "connected to #1"
  493.            CASE 3: PRINT "connected to #3"
  494.            CASE 6: PRINT "connected to #6"
  495.          ENDSWITCH
  496.  
  497.     The CONNECTED variable is also used in conjunction with the DIAL
  498.     statement. If the dialing is successful and connect to a remote
  499.     system, the variable is set to the number of the connected entry. If
  500.     the DIAL statement aborts without connection, the variable CONNECTED
  501.     is set to FALSE, indicating that the DIAL statement is aborted by
  502.     operator or the number of attempt exceeds the dial attempt setting.
  503.     For example,
  504.  
  505.          DIAL "1 3 6"
  506.          IF NOT CONNECTED
  507.             PRINT "Dialing process aborted"
  508.             STOP
  509.          ENDIF
  510.          SWITCH connected
  511.            CASE 1: PRINT "connected to #1"
  512.            CASE 3: PRINT "connected to #3"
  513.            CASE 6: PRINT "connected to #6"
  514.          ENDSWITCH
  515.  
  516.     Note that this variable reflects the online status only if your modem
  517.     reports so. You should check your modem manual to ensure that the
  518.     modem CD (carrier detect) signal is reflecting the actual online
  519.     status. Most modems use a "&C1" AT command to set it and you should
  520.     add it to the modem init string.
  521.  
  522.  
  523.  
  524. TELEMATE SCRIPT                                             VARIABLES    8
  525.  
  526.  
  527. FOUND
  528.  
  529.     This variable is set to resulting value after the WAITFOR statement is
  530.     executed. It is set to FALSE if time exceeded. Otherwise, it is set to
  531.     the string number of the matched string. For example,
  532.  
  533.          WAITFOR "NO CARRIER","thanks for calling","hang up now",100
  534.          SWITCH FOUND
  535.             CASE 1: PRINT "'NO CARRIER' found"
  536.             CASE 2: PRINT "'thanks for calling' found"
  537.             CASE 3: PRINT "'hang up now' found"
  538.          ENDSWITCH
  539.  
  540.  
  541. SUCCESS
  542.  
  543.     This variable is used by several statements. The resulting values and
  544.     descriptions is shown in the following table.
  545.  
  546.     Statement    Value    Description
  547.     ─────────    ─────   ──────────────────────────────────────────
  548.     Append       TRUE     the file is successfully opened or created
  549.                  FALSE    cannot create file
  550.  
  551.     ChDir        TRUE     directory changed
  552.                  FALSE    invalid path
  553.  
  554.     Close        TRUE     file closed
  555.                  FALSE    cannot close file
  556.  
  557.     Create       TRUE     the file is successfully created
  558.                  FALSE    cannot create file
  559.  
  560.     Delete       TRUE     the file is successfully deleted
  561.                  FALSE    cannot delete file
  562.  
  563.     FileSize     TRUE     the file size is determined successfully
  564.                  FALSE    cannot open file
  565.  
  566.     InputCh ch   TRUE     a character is read into <ch>
  567.                  FALSE    no character is available
  568.  
  569.     LoadFon      TRUE     the phone directory is successfully opened
  570.                  FALSE    the phone directory cannot be opened
  571.  
  572.     LoadKey      TRUE     the keyboard file is successfully opened
  573.                  FALSE    the keyboard file cannot be opened
  574.  
  575.     LoadMac      TRUE     the macro table is successfully opened
  576.                  FALSE    the macro table cannot be opened
  577.  
  578.  
  579. TELEMATE SCRIPT                                             VARIABLES    9
  580.  
  581.  
  582.     LoadPad      TRUE     the keypad table is successfully opened
  583.                  FALSE    the keypad table cannot be opened
  584.  
  585.     LogOn        TRUE     the log file is successfully opened
  586.                  FALSE    the log file cannot be created
  587.  
  588.     Open         TRUE     the file is successfully opened
  589.                  FALSE    the file does not exist
  590.  
  591.     Read str     TRUE     a line is read into <str>
  592.                  FALSE    end of file encountered.
  593.  
  594.     ReadCh ch    TRUE     a character is read into <ch>
  595.                  FALSE    end of file encountered.
  596.  
  597.     Receive      TRUE     all files are received successfully
  598.                  FALSE    file transfer aborted
  599.  
  600.     Rename       TRUE     the file is successfully renamed
  601.                  FALSE    cannot rename file
  602.  
  603.     Seek         TRUE     the file pointer is moved successfully
  604.                  FALSE    disk error
  605.  
  606.     Send         TRUE     all files are sent successfully
  607.                  FALSE    file transfer aborted
  608.  
  609.     Tell pos     TRUE     the file pointer is stored in <pos>
  610.                  FALSE    disk error
  611.  
  612.     Write        TRUE     write successary to file
  613.                  FALSE    cannot write to file
  614.  
  615.  
  616. LOGGING
  617.  
  618.     This variable reflects the current file log status and has the values
  619.  
  620.          0   log file close or log file not in use
  621.          1   log file open and capturing incoming data
  622.          2   log file in pause state
  623.  
  624.  
  625. WIDTH
  626.  
  627.     This variable stored the width of the zoomed terminal window which is
  628.     equal to the screen width. Possible values are 80 or 132.
  629.  
  630.  
  631.  
  632. TELEMATE SCRIPT                                            VARIABLES    10
  633.  
  634.  
  635. HEIGHT
  636.  
  637.     This variable is the height of the zoomed terminal window which is
  638.     calculated as
  639.  
  640.          HEIGHT = screen height
  641.          if ( menu bar present )
  642.                  HEIGHT = HEIGHT - 1
  643.          if ( status line present )
  644.                  HEIGHT = HEIGHT - 1
  645.          if ( HEIGHT < 24 )
  646.                  HEIGHT = 24
  647.  
  648.     For example, on EGA 43 line mode with both menu bar and status line
  649.     present, HEIGHT is equal to 41. But on 25 line mode, HEIGHT is equal
  650.     to 24, not 23, because Telemate's terminal has at least 24 lines
  651.     though only 23 lines may be shown on screen. In this case, terminal
  652.     will shift up and down to justify the display region.
  653.  
  654.     This variable may alter between two instructions if the users press
  655.     [Alt -] to toggle the menu bar and status line. When programming full
  656.     screen procedure, you should assume there are 23 lines in the screen
  657.     and DO NOT scroll the screen by going to the last line and perform a
  658.     line feed.
  659.  
  660.  
  661. TELEMATE SCRIPT                                          EXPRESSIONS    11
  662.  
  663.  
  664. EXPRESSIONS
  665. ──────────────────────────────────────────────────────────────────────────
  666.  
  667. Rule Of Precedence
  668. ──────────────────────────────────────────────────────────────────────────
  669.  
  670.     Expressions are made up of operators and operands. In complex
  671.     expressions, rule of precedence clarify the order in which operations
  672.     are performed.
  673.  
  674.          Operators           Precedence
  675.          ──────────────      ────────────
  676.          *,/                 first (high)
  677.          +,-                 second
  678.          =,<>,<,>,<=,>=      third
  679.          not                 fourth
  680.          and, or, xor        fifth (low)
  681.  
  682.     There are the rules of precedence
  683.  
  684.       1. First, an operand between two operators of difference precedence
  685.          is bound to the operator with higher precedence.
  686.       2. Second, an operand between two equal operators is bound to the
  687.          one on its left.
  688.       3. Third, expressions within parentheses are evaluated prior to
  689.          being treated as a single operand.
  690.  
  691.  
  692. Arithmetic Operators
  693. ──────────────────────────────────────────────────────────────────────────
  694.  
  695.     The types of operands for arithmetic operators are shown in the
  696.     following table.
  697.  
  698.          Operators   Operation        Operand Type
  699.          ─────────   ──────────────   ────────────
  700.              +       addition         integer
  701.              -       subtraction      integer
  702.              *       multiplication   integer
  703.              /       division         integer
  704.  
  705.     For example, the formula to convert Fahrenheit temperature to Celsius
  706.     equivalents is
  707.  
  708.          celsius = (fahr-32) * 5 / 9
  709.  
  710.  
  711.  
  712. TELEMATE SCRIPT                                          EXPRESSIONS    12
  713.  
  714.  
  715. Boolean Operators
  716. ──────────────────────────────────────────────────────────────────────────
  717.  
  718.     The types of operands for arithmetic operators are shown in the
  719.     following table.
  720.  
  721.          Operators   Operation     Operand Type
  722.          ─────────   ───────────   ────────────
  723.             not      negation      boolean
  724.             and      logical and   boolean
  725.             or       logical or    boolean
  726.             xor      logical xor   boolean
  727.  
  728.     Normal Boolean logic governs the results of these operations. For
  729.     instance, 'a and b' is TRUE only if both <a> an <b> are TRUE.
  730.  
  731.  
  732. Relational Operators
  733. ──────────────────────────────────────────────────────────────────────────
  734.  
  735.     The types of operands for arithmetic operators are shown in the
  736.     following table. They all have the same precedence.
  737.  
  738.          Operators Operation    Operand Types
  739.          ───────── ──────────── ───────────────────────────
  740.             =      equal to     integer, string, date, time
  741.             <>     not equal to integer, string, date, time
  742.             >      greater than integer, string, date, time
  743.             >=     greater or   integer, string, date, time
  744.                    equal to
  745.             <      less then    integer, string, date, time
  746.             <=     less then or integer, string, date, time
  747.                    equal to
  748.  
  749.     When the operands are integer, date or time, the comparison will
  750.     produce the usual result such as
  751.  
  752.             Condition          Result   Operands Type
  753.      ───────────────────────   ──────   ─────────────
  754.               1 > 2            FALSE    integer
  755.      "12-31-89" < "01-01-90"   TRUE     date
  756.      "00:00:00" > "23:59:59"   FALSE    time
  757.  
  758.     However, if the operands are strings, the operators "<", ">" and "<>"
  759.     have another meaning such that you can determine if a string is a sub-
  760.     string of another string.
  761.  
  762.         s1 <  s2    if   s1 is a sub-string of s2
  763.         s3 >  s4    if   s3 is a super-string of s4
  764.         s5 <> s6    if   s5 is not a sub-string of s6 and
  765.                          s5 is not a super-string of s6
  766.  
  767. TELEMATE SCRIPT                                          EXPRESSIONS    13
  768.  
  769.  
  770.     For example,
  771.  
  772.            Condition         Result   Explanation
  773.       ────────────────────   ──────   ──────────────────────────────────
  774.         "hello" =  "Hello"   TRUE     TMScript is not case sensitive.
  775.       "goodbye" <  "bye"     TRUE     "bye" is a sub-string of "goodbye"
  776.           "dog" <> "car"     TRUE     The string is not equal
  777.           "abc" >= "xyz"     FALSE    "abc" is not a super-string of
  778.                                       "xyz" and they are not equal.
  779.  
  780. TELEMATE SCRIPT                                STRUCTURED STATEMENTS    14
  781.  
  782.  
  783. STATEMENTS
  784. ──────────────────────────────────────────────────────────────────────────
  785.  
  786.     Statements describe algorithmic actions that can be executed.
  787.  
  788.  
  789. Comment
  790. ──────────────────────────────────────────────────────────────────────────
  791.  
  792.     Any characters after ";" are ignored by the TMScript compiler.
  793.  
  794.  
  795. Assignment Statement
  796. ──────────────────────────────────────────────────────────────────────────
  797.  
  798.     Assignment statements replace the current value of a variable with a
  799.     new value specified by an expression. The expression must be
  800.     assignment-compatible with the type of the variable.
  801.  
  802.     The program prints the following table of Fahrenheit temperatures and
  803.     their centigrade or Celsius equivalents.
  804.  
  805.          0     -17
  806.          20    -6
  807.          40    4
  808.          ...   ...
  809.          280   137
  810.          300   148
  811.  
  812.     Here is the program itself.
  813.  
  814.          ; Print Fahrenheit-Celsius table
  815.          ;       for f = 0, 20, ... , 300
  816.  
  817.          INTEGER lower,upper,step
  818.          INTEGER fahr,celsius
  819.  
  820.          lower = 0       ; lower limit of temperature table
  821.          upper = 300     ; upper limit
  822.          step  = 20      ; step size
  823.  
  824.          fahr  = lower                    ; first item in the table
  825.          WHILE fahr <= upper
  826.             celsius = (fahr-32) * 5 / 9   ; calcuate the values
  827.             PRINT fahr,"^I",celsius       ; print the result
  828.             fahr = fahr + step            ; next item in the table
  829.          ENDWHILE
  830.  
  831.  
  832.  
  833. TELEMATE SCRIPT                                STRUCTURED STATEMENTS    15
  834.  
  835.  
  836. If Statement
  837. ──────────────────────────────────────────────────────────────────────────
  838.  
  839.     The general form for IF statement is
  840.  
  841.          IF condition
  842.             statements
  843.          ENDIF
  844.  
  845.     The <statements> is executed only if <condition> is TRUE. Another form
  846.     is
  847.  
  848.          IF condition
  849.             statements-1
  850.          ELSE
  851.             statements-2
  852.          ENDIF
  853.  
  854.     One and only one of the two statements associated with an <if-else> is
  855.     done. If the <condition> is true, <statements-1> is executed; if not,
  856.     <statements-2> is executed.
  857.  
  858.     The construction
  859.  
  860.          IF condition-1
  861.             statements-1
  862.          ELSE
  863.             IF condition-2
  864.                statements-2
  865.             ELSE
  866.                IF condition-3
  867.                   statements-3
  868.                ENDIF
  869.             ENDIF
  870.          ENDIF
  871.  
  872.     occurs so often that it is worth a new keyword ELSEIF. The statement
  873.     can be re-written as
  874.  
  875.          IF     condition-1
  876.                statements-1
  877.          ELSEIF condition-2
  878.                statements-2
  879.          ELSEIF condition-3
  880.                statements-3
  881.          ENDIF
  882.  
  883.  
  884.  
  885. TELEMATE SCRIPT                                STRUCTURED STATEMENTS    16
  886.  
  887.  
  888. Switch Statement
  889. ──────────────────────────────────────────────────────────────────────────
  890.  
  891.     The SWITCH statement is a special multi-way decision maker that tests
  892.     whether an expression matches one of a number of values, an branches
  893.     accordingly. The syntax for SWITCH statement is
  894.  
  895.          SWITCH expression
  896.            CASE value-1:
  897.               statements-1
  898.            CASE value-2,value-3:
  899.               statements-2
  900.            OTHERWISE:
  901.               statements-3
  902.          ENDSWITCH
  903.  
  904.     The SWITCH evaluates the expression and compares its value to all the
  905.     cases. Each cases must be labeled by the values of the same type as
  906.     the expression. Several values can be separated by comma. If a case
  907.     matches the expression value, execution starts at that case and ends
  908.     at the next case label. The case labeled OTHERWISE is executed if none
  909.     of the other cases is satisfied. A OTHERWISE is optional; if it isn't
  910.     there and if none of the cases matches, no action at all takes place.
  911.     However, OTHERWISE, if exists, must be placed after all the case
  912.     labels.
  913.  
  914.     The program counts digits, blanks, others.
  915.  
  916.          nDigit = 0          ; digit
  917.          nBlank = 0          ; blank
  918.          nOther = 0          ; others
  919.          OPEN "MYFILE"       ; open the file "MYFILE"
  920.          READCH ch           ; read the first character
  921.          WHILE success       ; if not end of file
  922.             SWITCH ch
  923.               CASE "0","1","2","3","4","5","7","8","9":  ; is digit
  924.                  nDigit = nDight + 1
  925.               CASE " ":                                  ; is blank
  926.                  nBlank = nBlank + 1
  927.               OTHERWISE:                                 ; others
  928.                  nOther = nOther + 1
  929.             ENDSWITCH
  930.             READCH ch        ; read next character
  931.          ENDWHILE
  932.          CLOSE               ; close the file
  933.          PRINT nDigit        ; print the results
  934.          PRINT nBlank
  935.          PRINT nOther
  936.  
  937.  
  938.  
  939. TELEMATE SCRIPT                                STRUCTURED STATEMENTS    17
  940.  
  941.  
  942. While Loop
  943. ──────────────────────────────────────────────────────────────────────────
  944.  
  945.     The WHILE loop is the most general loop. The syntax is
  946.  
  947.          WHILE condition
  948.             statements
  949.          ENDWHILE
  950.  
  951.     The <condition> is tested. If it is true, the body of the loop (all
  952.     the statements before the keyword ENDWHILE is executed. Then the
  953.     condition is re-tested, and if true, the body is executed again. When
  954.     the test becomes false the loop ends, and execution continues at the
  955.     statements that follows the loop.
  956.  
  957.     For example, to print the value from 1 to 100, you can write
  958.  
  959.          i = 1               ; start from 1
  960.          WHILE i<=100        ; check if it in the range
  961.             PRINT i          ; print the number
  962.             i = i + 1        ; increase the counter by 1
  963.          ENDWHILE
  964.  
  965.  
  966. Repeat Loop
  967. ──────────────────────────────────────────────────────────────────────────
  968.  
  969.     While the WHILE loop test the condition at the top, the REPEAT loop
  970.     test it at the bottom. It tests at the bottom after making each pass
  971.     through the loop body; the body is always executed at least once.
  972.     Consider the loop
  973.  
  974.          REPEAT
  975.             statements
  976.          UNTIL condition
  977.  
  978.     The statements is executed, then the condition is evaluated. If it is
  979.     false, the statements is evaluated again, and so on. If the condition
  980.     becomes true, the loop terminates.
  981.  
  982.     For example, to print the value from 1 to 100, you can write
  983.  
  984.          i = 1               ; start from 1
  985.          REPEAT
  986.             PRINT i          ; print the number
  987.             i = i + 1        ; increase the counter by 1
  988.          UNTIL i>100         ; repeat until it is NOT in the range
  989.  
  990.  
  991.  
  992. TELEMATE SCRIPT                                STRUCTURED STATEMENTS    18
  993.  
  994.  
  995. Exit Statement
  996. ──────────────────────────────────────────────────────────────────────────
  997.  
  998.     It is sometimes convenient to be able to control loop exits other than
  999.     by testing at the top or bottom. The EXIT statement provides an early
  1000.     exit from the loops. A EXIT statement causes the innermost loop to be
  1001.     exited immediately.
  1002.  
  1003.     The following program accept strings from keyboard, using a EXIT to
  1004.     exit from the loop when the string contains an [Esc] ("^[").
  1005.  
  1006.          REPEAT
  1007.             INPUT s
  1008.             IF "^[" <= s     ; test if [Esc] is a sub-string of s
  1009.                EXIT          ;   before printing it
  1010.             ENDIF
  1011.             PRINT s
  1012.          UNTIL s = ""        ; repeat until an empty string is entered
  1013.  
  1014.  
  1015. #include Directive
  1016. ──────────────────────────────────────────────────────────────────────────
  1017.  
  1018.     This compiler directive allows you to write reusable procedures in a
  1019.     separate file and imports the procedures conveniently. The syntax is
  1020.  
  1021.          #include "includefile"
  1022.  
  1023.     The <includefile> will be inserted as if it is physical appear in this
  1024.     point. The <includefile> must be a pathname with extension. For
  1025.     example,
  1026.  
  1027.          #include "TOOLBOX.SCR"
  1028.          #include "MYLIB.SCR"
  1029.  
  1030.     inserts the TOOLBOX.SCR and MYLIB.SCR into this point.
  1031.  
  1032.     The #include directive can be nested as deep as 10 levels.
  1033.  
  1034.  
  1035. TELEMATE SCRIPT                                            PROCEDURE    19
  1036.  
  1037.  
  1038. PROCEDURE
  1039. ──────────────────────────────────────────────────────────────────────────
  1040.  
  1041.     In TMScript, a procedure is equivalent to a subroutine or function in
  1042.     Fortran, or procedure in Pascal, C etc. A procedure provides a
  1043.     convenient way to encapsulate some computation in a black box, which
  1044.     can then be used without worrying about its innards.
  1045.  
  1046.     For example, to swap the values of two variables, <i> and <j>, you
  1047.     have to write three lines as follows
  1048.  
  1049.          temp = i       ; put <i> into a temporary variable
  1050.          i = j          ; put <j> into <i>
  1051.          j = temp       ; now put the value of <i> into <j>
  1052.  
  1053.     Suppose in your script there are a lot of swapping, it will be
  1054.     convenient to define a procedure called <swap> to perform the
  1055.     swapping. Then your main program will look like
  1056.  
  1057.          i = 1
  1058.          j = 2
  1059.          swap i,j       ; now i=2, j=1
  1060.          PRINT i        ; 2
  1061.          PRINT j        ; 1
  1062.  
  1063.     This is only a small usage of procedure. Imagine if the procedure is
  1064.     very complex, you can use it again and again once it is tested and
  1065.     performs what you need.
  1066.  
  1067.  
  1068. Procedure Declaration
  1069. ──────────────────────────────────────────────────────────────────────────
  1070.  
  1071.     The syntax of a procedure definition is
  1072.  
  1073.          PROCEDURE <procname> <parameter declaration>
  1074.          <local variable declaration>
  1075.          <statement part>
  1076.          ENDPROC
  1077.  
  1078.     <procname> is any valid identifier. <parameter declaration> can be
  1079.     omitted if the procedure does not required parameters. See next
  1080.     section for details on parameter declaration.
  1081.  
  1082.     <local variable declaration> made within a given procedure are visible
  1083.     only within that procedure. This part should ALWAYS be included in
  1084.     order to make the program easy to be traced although the declarations
  1085.     may be omitted.
  1086.  
  1087.     <statement part> can be considered as a sub-program of the main
  1088.     program and obeys all the rule described above.
  1089.  
  1090. TELEMATE SCRIPT                                            PROCEDURE    20
  1091.  
  1092.  
  1093. Parameter Declaration
  1094. ──────────────────────────────────────────────────────────────────────────
  1095.  
  1096.     Parameter declaration is similar to variable declaration. For example,
  1097.  
  1098.          PROCEDURE sample STRING s,t,INTEGER i,j
  1099.  
  1100.     declares the procedure <sample> with two string parameters <s> and <t>
  1101.     and two integer parameters <i> and <j>. You may use any combination of
  1102.     STRING and INTEGER to define parameters. For example,
  1103.  
  1104.          PROCEDURE sample INTEGER i,STRING p,q,r,s,INTEGER j,k,STRING z
  1105.  
  1106.     We can write the <swap> procedure as
  1107.  
  1108.          PROCEDURE swap INTEGER value1,value2 ; swap two integers
  1109.          INTEGER temp        ; declare a local variable
  1110.          temp = value1       ; store the first value
  1111.          value1 = value2     ; replace with the second value
  1112.          value2 = temp       ; replace with the first value
  1113.          ENDPROC
  1114.  
  1115.     After that, the main program may look like
  1116.  
  1117.          i = 1
  1118.          j = 2
  1119.          k = 3
  1120.          swap i,j            ; now i=2, j=1
  1121.          swap j,k            ; now j=3, k=1
  1122.          PRINT i,j,k         ; 2,3,1
  1123.  
  1124.  
  1125. Calling Procedure and Parameter Passing
  1126. ──────────────────────────────────────────────────────────────────────────
  1127.  
  1128.     Once the procedure is defined, it can be called by putting the
  1129.     procedure name in the statement part. In the example, the statements
  1130.  
  1131.          i = 1
  1132.          j = 2
  1133.          swap i,j            ; now i=2, j=1
  1134.          PRINT i,j           ; 2,1
  1135.  
  1136.     call the <swap> procedure with the parameters <i> and <j>.
  1137.  
  1138.     In the above example, the method used to pass <i> and <j> to the
  1139.     procedure <swap> is called 'pass by reference' because <i> and <j> can
  1140.     be changed when return. There is another method called 'pass by value'
  1141.     of which the parameter cannot be changed.
  1142.  
  1143.  
  1144. TELEMATE SCRIPT                                            PROCEDURE    21
  1145.  
  1146.  
  1147.     Consider the following procedure
  1148.  
  1149.          PROCEDURE countDown INTEGER num ; print from <num> to 1
  1150.          WHILE num >= 1              ; check if it is in the range
  1151.             PRINT num                ; print it
  1152.             num = num-1              ; decrease until num=0
  1153.          ENDWHILE
  1154.          ENDPROC
  1155.  
  1156.          countDown 100               ; pass by value
  1157.          n = 100
  1158.          countDown n*2               ; pass by value (200)
  1159.          PRINT n                     ; n = 100
  1160.          countDown (n)               ; pass by value (100)
  1161.          PRINT n                     ; n = 100
  1162.          countDown n                 ; pass by reference
  1163.          PRINT n                     ; n = 0 !
  1164.  
  1165.     If we supply <countDown> with the parameter 100, n*2 or (n), they are
  1166.     'pass by value'. On the other hand, <n> is 'pass by reference' in the
  1167.     last statement.
  1168.  
  1169.     The general rule of method of passing parameters is:
  1170.  
  1171.          When the parameter is a constant, an expression or surrounded
  1172.          by parentheses, it is 'pass by value'. Otherwise, it is a
  1173.          variable and is 'pass by reference'.
  1174.  
  1175.     The rule applies to string parameter as well. To prevent confusion, we
  1176.     should rewrite the <countDown> procedure by introducing a local
  1177.     variable.
  1178.  
  1179.          PROCEDURE countDown INTEGER num ; print from <num> to 1
  1180.          INTEGER count               ; introduce a local variable
  1181.          count = num                 ;  if neccessary
  1182.          WHILE count >= 1            ; check if it is in the range
  1183.             PRINT count              ; print it
  1184.             count = count-1          ; decrease until 0
  1185.          ENDWHILE
  1186.          ENDPROC                     ; this does not change <num>
  1187.  
  1188.  
  1189.  
  1190. TELEMATE SCRIPT                                            PROCEDURE    22
  1191.  
  1192.  
  1193. Nested Procedures and Scope of Variables
  1194. ──────────────────────────────────────────────────────────────────────────
  1195.  
  1196.     TMScript allows nested procedures; you can declare one procedure
  1197.     inside of another. For example,
  1198.  
  1199.          PROCEDURE outer
  1200.          STRING i,j
  1201.  
  1202.             PROCEDURE inner
  1203.             INTEGER i
  1204.             i = 100
  1205.             PRINT "i = ",i
  1206.             PRINT "j = ",j
  1207.             ENDPROC
  1208.  
  1209.          i = "This is string 'i'."
  1210.          j = "This is string 'j'."
  1211.          inner
  1212.          PRINT "i = ",i
  1213.          PRINT "j = ",j
  1214.          ENDPROC
  1215.  
  1216.     The <outer> procedure declares two string variables, <i> and <j>.
  1217.     These two variables can be accessed by both the <outer> procedure and
  1218.     the <inner> one because they are declared before the <inner>
  1219.     procedure.
  1220.  
  1221.     The <inner> procedure declares an integer variable <i>. Although the
  1222.     two <i>'s share the same name, they are not identical. The inner <i>
  1223.     is visible in the <inner> procedure but not in the <outer> procedure.
  1224.     On the other hand, the outer <i> can no longer be accessible in the
  1225.     <inner> procedure. The statement
  1226.  
  1227.          i = 100
  1228.  
  1229.     does not affect the outer <i>. This is called the scope rule.
  1230.  
  1231.     The output of the program is
  1232.  
  1233.          i = 100
  1234.          j = This is string 'j'.
  1235.          i = This is string 'i'.
  1236.          j = This is string 'j'.
  1237.  
  1238.  
  1239.  
  1240. TELEMATE SCRIPT                                            PROCEDURE    23
  1241.  
  1242.  
  1243. Return Statement
  1244. ──────────────────────────────────────────────────────────────────────────
  1245.  
  1246.     Like the EXIT statement, it is sometimes convenient to be able to
  1247.     return from a procedure at the middle of the procedure.
  1248.  
  1249.     The following procedure accept strings from keyboard and print it,
  1250.     using a RETURN to return from the procedure when the string contains
  1251.     an [Esc] ("^[").
  1252.  
  1253.          PROCEDURE acceptString STRING s
  1254.          INPUT s
  1255.          IF "^[" <= s     ; test if [Esc] is a sub-string of s
  1256.             RETURN        ;   before printing it
  1257.          ENDIF
  1258.          PRINT s
  1259.          ENDPROC
  1260.  
  1261. TELEMATE SCRIPT                      BUILT IN PROCEDURES BY CATEGORY    24
  1262.  
  1263.  
  1264. BUILT IN PROCEDURES BY CATEGORY
  1265. ──────────────────────────────────────────────────────────────────────────
  1266.  
  1267. Console I/O
  1268. ──────────────────────────────────────────────────────────────────────────
  1269.  
  1270.     There are eight statements in the group of console input and output.
  1271.     Namely,
  1272.  
  1273.      Input, InputCh, Print, AT, Clear Text, Clear Key, WhereX, WhereY
  1274.  
  1275. PRINT Statement
  1276.  
  1277.     Output is simple, the PRINT statement can print variable or constant
  1278.     of types integer or string to the terminal window. For example,
  1279.  
  1280.          PRINT "hello, world"
  1281.  
  1282.     print the words
  1283.  
  1284.          hello, world
  1285.  
  1286.     to the terminal window.
  1287.  
  1288.     PRINT supplies a newline automatically. However, if a comma ","
  1289.     follows the string, no newline is supplied. The statement above could
  1290.     just as well have been written
  1291.  
  1292.          PRINT "hello, ",
  1293.          PRINT "world",
  1294.          PRINT
  1295.  
  1296.     to produce an identical output. The last PRINT statement supplies a
  1297.     newline.
  1298.  
  1299.     PRINT statement accepts more than one argument. Each two arguments are
  1300.     separated by a comma. For example,
  1301.  
  1302.          PRINT "x = ",x
  1303.          PRINT "My name is ",firstName," ",lastName
  1304.          PRINT
  1305.  
  1306.  
  1307. COM I/O
  1308. ──────────────────────────────────────────────────────────────────────────
  1309.  
  1310.     As a communication program, TMScript provides thirteen I/O statements
  1311.     that communicate with the remote system. They are
  1312.  
  1313.          Get, GetCh, Put, Clear COM, ComInCount, ComOutCount
  1314.          HangUp, Receive, Send, Waitfor, When, WhenIdle
  1315.  
  1316. TELEMATE SCRIPT                      BUILT IN PROCEDURES BY CATEGORY    25
  1317.  
  1318.  
  1319. PUT Statement
  1320.  
  1321.     COM output is as simple as console output, the PUT statement can send
  1322.     variable or constant of types integer or string to the remote system.
  1323.     For example,
  1324.  
  1325.          PUT "first last"
  1326.  
  1327.     send the words
  1328.  
  1329.          first last
  1330.  
  1331.     and a carriage return [Ctrl M] to the remote system.
  1332.  
  1333.     PUT supplies a carriage return automatically. However, if a comma ","
  1334.     follows the string, no carriage return is supplied. The statement
  1335.     above could just as well have been written
  1336.  
  1337.          PUT "first ",
  1338.          PUT "last",
  1339.          PUT
  1340.  
  1341.     to produce an identical output. The last PUT statement supplies a
  1342.     carriage return only.
  1343.  
  1344.     PUT statement accepts more than one argument. Each two arguments are
  1345.     separated by a comma. For example,
  1346.  
  1347.          PUT firstName,";",lastName,";",password
  1348.  
  1349.  
  1350. WAITFOR Statement
  1351.  
  1352.     The WAITFOR statements waits for specified stirngs from the remote
  1353.     system in a specified time. In TMScript, you can specify more than one
  1354.     string to wait for. If any of them is received, the FOUND variable is
  1355.     set to a non-zero value (TRUE). Combined with the PUT statement, you
  1356.     can tell Telemate when to send a string to the remote system.
  1357.  
  1358.       Syntax                         Description
  1359.       ──────────────────────────     ─────────────────────────────────
  1360.       WAITFOR t                      Set default waiting time
  1361.       WAITFOR s1,s2, ... , sN        Wait until one of the strings is
  1362.                                      received
  1363.       WAITFOR s1,s2, ... , sN, t     Wait until one of the strings is
  1364.                                      received or waiting time exceeded
  1365.  
  1366.  
  1367. TELEMATE SCRIPT                      BUILT IN PROCEDURES BY CATEGORY    26
  1368.  
  1369.  
  1370.     For example, the following code segment are usally used in a logon
  1371.     script program.
  1372.  
  1373.          WAITFOR "first",30        ; wait for "first" in 30 seconds
  1374.          IF NOT FOUND
  1375.             STOP                   ; stop if prompt not found
  1376.          ENDIF
  1377.          PUT "my name"             ; send the name
  1378.  
  1379.          WAITFOR "password",5      ; wait for "password" in 5 seconds
  1380.          IF NOT FOUND
  1381.             STOP                   ; stop if prompt not found
  1382.          ENDIF
  1383.          PUT "^&"                  ; send the password field (^&) in
  1384.                                    ;  in the phone directory
  1385.  
  1386.  
  1387. File Handling
  1388. ──────────────────────────────────────────────────────────────────────────
  1389.  
  1390.     One text file is allowed to open at a time. The file is open or
  1391.     created as a read/write file. The file handling procedures are
  1392.  
  1393.        Open, Created, Append, Read, ReadCh, Write, Seek, Tell, Close,
  1394.        ChDir, Delete, Rename, FileExist, FileSize
  1395.  
  1396.     The predefined variable SUCCESS is set to FALSE if there is any error.
  1397.  
  1398.  
  1399. String Handling
  1400. ──────────────────────────────────────────────────────────────────────────
  1401.  
  1402.     A string is a sequence of character. The limit of the length of a
  1403.     string is 512 characters. When referring to a character position, the
  1404.     position is counted from 1. The string handling procedures are
  1405.  
  1406.      Atoi, Concat, Itoa, Length, StrDel, StrIns, StrPos, StrSet, SubStr
  1407.  
  1408.  
  1409. Miscellaneous Routines
  1410. ──────────────────────────────────────────────────────────────────────────
  1411.      Alarm, Atoi, Date, Delay, Dial, Dos, ExitTelemate, Image, Itoa,
  1412.      Keystroke, LoadFon, LoadKey, LoadMac, LoadPad, LogOff, LogOn,
  1413.      LogPause, LogResume, Query, Script, Set, Time, WaitUntil
  1414.  
  1415. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    27
  1416.  
  1417.  
  1418. BUILT IN PROCEDURES
  1419. ──────────────────────────────────────────────────────────────────────────
  1420.  
  1421. Alarm
  1422. ──────────────────────────────────────────────────────────────────────────
  1423.  
  1424. Function     Pop-up the alarm dialog.
  1425.  
  1426. Syntax       ALARM
  1427.              ALARM message
  1428.  
  1429. Remarks      If the string <message> is specified, it is displayed in
  1430.              the alarm dialog.
  1431.  
  1432.              If the message is too long, it can be split to several
  1433.              lines by putting a "^J" between each line.
  1434.  
  1435. Return       If the operator press [Enter] or click the OK button in
  1436.              the alarm dialog, SUCCESS is set to TRUE (non-zero).
  1437.  
  1438.              If the operator press [Esc] or the alarm time excess,
  1439.              SUCCESS is set to FALSE (zero).
  1440.  
  1441. See also     Set AlarmSound, Set AlarmTime
  1442.  
  1443. Example
  1444.  
  1445.      RECEIVE "s"
  1446.      IF NOT SUCCESS
  1447.         ALARM "Warning: File transfer aborted"
  1448.         IF NOT SUCCESS  ; if timeout, print message on screen
  1449.            PRINT "Warning: File transfer aborted"
  1450.         ENDIF
  1451.      ENDIF
  1452.  
  1453.      ALARM "Alarm:^JThis is a^Jvery long message"
  1454.  
  1455.  
  1456. Append
  1457. ──────────────────────────────────────────────────────────────────────────
  1458.  
  1459. Function     Opens a text file, creates it if necessary, and moves the
  1460.              file pointer to the end of the file.
  1461.  
  1462. Syntax       APPEND filename
  1463.  
  1464. Remark       APPEND opens the text file as a read/write file and strip the
  1465.              ending EOF [Ctrl Z].
  1466.  
  1467. Return       Upon successful completion, SUCCESS is set to TRUE. If the
  1468.              file cannot be created, SUCCESS is set to FALSE.
  1469.  
  1470. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    28
  1471.  
  1472.  
  1473. See also     Create, Open
  1474.  
  1475.  
  1476. At
  1477. ──────────────────────────────────────────────────────────────────────────
  1478.  
  1479. Function     Positions cursor in terminal window.
  1480.  
  1481. Syntax       AT column,row
  1482.  
  1483. Remark       AT moves the cursor to the position within the terminal
  1484.              window. The upper left corner is (0,0) and the lower right
  1485.              corner is (79,24) if a 25 rows terminal is used.
  1486.  
  1487. See also     Print
  1488.  
  1489.  
  1490. Atoi
  1491. ──────────────────────────────────────────────────────────────────────────
  1492.  
  1493. Function     Converts a string to an integer.
  1494.  
  1495. Syntax       ATOI s,i
  1496.  
  1497. Return       <i> contains the converted value or 0 if <s> cannot be
  1498.              converted to a number.
  1499.  
  1500. See also     Itoa
  1501.  
  1502.  
  1503. ChDir
  1504. ──────────────────────────────────────────────────────────────────────────
  1505.  
  1506. Function     Changes current directory.
  1507.  
  1508. Syntax       CHDIR path
  1509.  
  1510. Remark       CHDIR causes the directory specified by <path> to become the
  1511.              current working directory. <path> must specify an existing
  1512.              directory.
  1513.  
  1514.              A drive can also be specified in <path> but it changes only
  1515.              the current directory on that drive; it doesn't change the
  1516.              active drive.
  1517.  
  1518. Return       Upon successful completion, SUCCESS is set to TRUE;
  1519.              otherwise, SUCCESS is FALSE.
  1520.  
  1521. See also     Delete, FileExist, Rename
  1522.  
  1523.  
  1524.  
  1525. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    29
  1526.  
  1527.  
  1528. Clear COM
  1529. ──────────────────────────────────────────────────────────────────────────
  1530.  
  1531. Function     Clears the COM buffer.
  1532.  
  1533. Syntax       CLEAR COM
  1534.  
  1535. Remark       Data being sent and received are placed in a COM buffer,
  1536.              sometimes it is necessary to clear the buffer before
  1537.              processing.
  1538.  
  1539. See also     Get, GetCh, Put
  1540.  
  1541. Example
  1542.  
  1543.      GET s      ; get a string
  1544.      DELAY 50   ; wait for 5 seconds
  1545.      CLEAR COM  ; clear the received data in the last 5 seconds
  1546.      GET s      ; get another string
  1547.  
  1548.  
  1549. Clear Key
  1550. ──────────────────────────────────────────────────────────────────────────
  1551.  
  1552. Function     Clears the keyboard buffer and gives up keyboard control
  1553.              after a INPUT or INPUTCH statement.
  1554.  
  1555. Syntax       CLEAR KEY
  1556.  
  1557. Remark       CLEAR KEY clears the content of the keyboard buffer. Keyboard
  1558.              input before this statement are thrown away.
  1559.  
  1560.              When the INPUT or INPUTCH statement in the script is
  1561.              executed, the following input characters are placed in a
  1562.              keyboard buffer no matter if we want to read the next key
  1563.              or not. As a result, the following characters are NOT sent to
  1564.              the remote system automatically. It is important to give up
  1565.              the control of keyboard whenever no more keyboard input is
  1566.              needed and the clear key statement is built for this purpose.
  1567.  
  1568. See also     Input, InputCh
  1569.  
  1570. Example
  1571.  
  1572.      PRINT "Input filename:"
  1573.      INPUT filename      ; ask the user to input a filename
  1574.      CLEAR KEY           ; give up keyboard control such that
  1575.                          ;  following keys are sent to remote
  1576.                          ;  system automatically
  1577.  
  1578.  
  1579. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    30
  1580.  
  1581.  
  1582. Clear Text
  1583. ──────────────────────────────────────────────────────────────────────────
  1584.  
  1585. Function     Clears the terminal window.
  1586.  
  1587. Syntax       CLEAR TEXT
  1588.  
  1589. Remark       CLEAR TEXT clears the terminal window and positions the
  1590.              cursor to the upper-left corner. It sets the display
  1591.              attribute to the initial setup.
  1592.  
  1593.  
  1594. Close
  1595. ──────────────────────────────────────────────────────────────────────────
  1596.  
  1597. Function     Closes a file.
  1598.  
  1599. Syntax       CLOSE
  1600.  
  1601. Return       Upon successful completion, SUCCESS is set to TRUE;
  1602.              otherwise, SUCCESS is FALSE.
  1603.  
  1604. See also     Open, Read, Write
  1605.  
  1606.  
  1607. ComInCount
  1608. ──────────────────────────────────────────────────────────────────────────
  1609.  
  1610. Function     Gets the number of characters in the incoming COM buffer.
  1611.  
  1612. Syntax       COMINCOUNT count
  1613.  
  1614. Remark       Telemate has an incoming COM buffer of 8000 bytes.
  1615.  
  1616. Return       <count> contains the number of characters in the incoming COM
  1617.              buffer.
  1618.  
  1619. See also     Clear COM
  1620.  
  1621.  
  1622. ComOutCount
  1623. ──────────────────────────────────────────────────────────────────────────
  1624.  
  1625. Function     Gets the number of characters in the outgoing COM buffer.
  1626.  
  1627. Syntax       COMOUTCOUNT count
  1628.  
  1629. Remark       Telemate has an outgoing COM buffer of 2000 bytes.
  1630.  
  1631. Return       <count> contains the number of characters in the outgoing COM
  1632.              buffer.
  1633.  
  1634. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    31
  1635.  
  1636.  
  1637. See also     Clear COM
  1638.  
  1639.  
  1640. Concat
  1641. ──────────────────────────────────────────────────────────────────────────
  1642.  
  1643. Function     Appends one string to another
  1644.  
  1645. Syntax       CONCAT dest,src
  1646.  
  1647. Remark       CONCAT appends a copy of <src> to the end of the string
  1648.              <dest>.
  1649.  
  1650.              If the backspace character "^H" is encountered in <src>, the
  1651.              last character of the concatenating string is erased.
  1652.  
  1653. Return       <dest> contains the concatenated string.
  1654.  
  1655. See also     Length, StrDel, StrIns
  1656.  
  1657. Example
  1658.  
  1659.      s = "abc"           ; s = "abc"
  1660.      CONCAT s,"xyz"      ; s = "abcxyz"
  1661.      CONCAT s,"^H"       ; s = "abcxy"
  1662.      CONCAT s,"pq"       ; s = "abcxypq"
  1663.  
  1664.  
  1665. Create
  1666. ──────────────────────────────────────────────────────────────────────────
  1667.  
  1668. Function     Creates a new text file or rewrites an existing one.
  1669.  
  1670. Syntax       CREATE filename
  1671.  
  1672. Remark       CREATE creates the new text file <filename>. If the file
  1673.              already exists, the old file is deleted.
  1674.  
  1675. Return       Upon successful completion, SUCCESS is set to TRUE;
  1676.              otherwise, SUCCESS is FALSE.
  1677.  
  1678. See also     Append, Open
  1679.  
  1680.  
  1681. Date
  1682. ──────────────────────────────────────────────────────────────────────────
  1683.  
  1684. Function     Gets system date.
  1685.  
  1686. Syntax       DATE today
  1687.  
  1688.  
  1689. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    32
  1690.  
  1691.  
  1692. Remark       DATE fills the string <today> with the current date.
  1693.  
  1694.              Dates can be compared with the usual '<', '>' and '='
  1695.              relational operator.
  1696.  
  1697.              The date format option in the main program does not affect
  1698.              the format in the script language.
  1699.  
  1700. Return       <today> contains the system current date in MM-DD-YY
  1701.              format.
  1702.  
  1703. See also     Time, ConvertDate
  1704.  
  1705. Example
  1706.  
  1707.      DATE today
  1708.      IF today>="01-01-91" AND today<"01-05-91"
  1709.         PRINT "Happy New Year!"
  1710.      ENDIF
  1711.  
  1712.  
  1713. Delay
  1714. ──────────────────────────────────────────────────────────────────────────
  1715.  
  1716. Function     Suspends script execution for an interval.
  1717.  
  1718. Syntax       DELAY t
  1719.  
  1720. Remark       With a call to DELAY, the script program is suspended from
  1721.              execution for the number of tenth seconds specified by <t>.
  1722.  
  1723. Example
  1724.  
  1725.      DELAY 15  ; wait for one and a half second
  1726.  
  1727.  
  1728. Delete
  1729. ──────────────────────────────────────────────────────────────────────────
  1730.  
  1731. Function     Deletes one or more files
  1732.  
  1733. Syntax       DELETE filename
  1734.  
  1735. Remark       DELETE deletes one or more files specified by <filename>.
  1736.  
  1737.              Wildcards are allowed in <filename>.
  1738.  
  1739. Return       On successful completion, SUCCESS is set to TRUE;
  1740.              otherwise, SUCCESS is FALSE.
  1741.  
  1742. See also     FileExist, Rename
  1743.  
  1744. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    33
  1745.  
  1746.  
  1747. Dial
  1748. ──────────────────────────────────────────────────────────────────────────
  1749.  
  1750. Function     Dials a list of entries or redials the current list.
  1751.  
  1752. Syntax       DIAL
  1753.              DIAL list
  1754.  
  1755. Remark       DIAL redials the the current list of entries. If <list> is
  1756.              specified, the current list is replaced by <list> and start
  1757.              dialing.
  1758.  
  1759.              The <DialAttempt> option is the maximum of number of dialing
  1760.              attempt.
  1761.  
  1762.              The <DialList> option can be used to specify the current dial
  1763.              list.
  1764.  
  1765. Return       DIAL sets CONNECTED to the number of the connected entry. If
  1766.              the operator press [Esc] to abort the dialing process or the
  1767.              attempts excess the <DialAttempt> option, CONNECTED is set to
  1768.              0 (FALSE).
  1769.  
  1770. See also     Set AutoRedial, Set DialAttempt, Set DialList, Set DialPause,
  1771.              Set DialTime, Set MultiLine
  1772.  
  1773. Example
  1774.  
  1775.      SET DialAttempt,3     ; try each entry once
  1776.      SET DialList,"1 3 6"  ; set the dial list
  1777.      DIAL                  ; equivalent to a DIAL "1 3 6" statement
  1778.      IF NOT CONNECTED
  1779.         PRINT "All boards are busy."
  1780.      ELSE
  1781.         SWITCH CONNECTED
  1782.           CASE 1: PRINT "connected to #1"
  1783.           CASE 3: PRINT "connected to #3"
  1784.           CASE 6: PRINT "connected to #6"
  1785.         ENDSWITCH
  1786.      ENDIF
  1787.      SET DialAttempt,0     ; unlimit the maximum attempt
  1788.  
  1789.  
  1790. Dos
  1791. ──────────────────────────────────────────────────────────────────────────
  1792.  
  1793. Function     Jumps to DOS or issues a DOS command.
  1794.  
  1795. Syntax       DOS
  1796.              DOS command
  1797.  
  1798.  
  1799. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    34
  1800.  
  1801.  
  1802. Remark       The DOS statement invokes the DOS COMMAND.COM file to execute
  1803.              a DOS command, batch file, or other program named by the
  1804.              string <command>. the program must be in the current
  1805.              directory or in one of the directories listed in the PATH
  1806.              environment string.
  1807.  
  1808.              If <command> is not specified, the DOS statement jumps to DOS
  1809.              and return when users enter 'EXIT' in the DOS command line.
  1810.  
  1811.              If the <SwapToEms> or the <SwapToDisk> option is turned on,
  1812.              Telemate swaps part of itself to second storage and, hence,
  1813.              leaves more memory space for the DOS shell.
  1814.  
  1815.              The COMSPEC envirnoment string is used to find the
  1816.              COMMAND.COM file. If your COMMAND.COM is not in the root
  1817.              directory - suppose in the C:\DOS directory, you should
  1818.              include the following in the AUTOEXEC.BAT startup file.
  1819.  
  1820.                    SET COMSPEC=C:\DOS\COMMAND.COM
  1821.  
  1822. See also     Set SwapToDisk, Set SwapToEms, Set MaxDosShell
  1823.  
  1824. Example
  1825.  
  1826.      QUERY SwapToEms,ems     ; store the original options
  1827.      QUERY SwapToDisk,disk
  1828.      QUERY MaxDosShell,max
  1829.      SET SwapToEms,on        ; provide more working space
  1830.      SET SwapToDisk,on       ;  for external program
  1831.      SET MaxDosShell,off     ;
  1832.      DOS "TMSTAT TM.USE"     ; run the TMSTAT.EXE program
  1833.      SET SwapToEms,ems
  1834.      SET SwapToDisk,disk     ; restore the original options.
  1835.      SET MaxDosShell,max
  1836.  
  1837.  
  1838. ExitTelemate
  1839. ──────────────────────────────────────────────────────────────────────────
  1840.  
  1841. Function     Terminates Telemate's execution.
  1842.  
  1843. Syntax       EXITTELEMATE
  1844.              EXITTELEMATE exitCode
  1845.  
  1846. Remark       EXITTELEMATE terminates Telemate and return to DOS. The file
  1847.              in the Edit window is saved automatically if necessary.
  1848.  
  1849.              If <exitCode> is not specified, Telemate exits to DOS with
  1850.              the error level 0. Otherwise, the error level is set to
  1851.              <exitCode>. Typically a value of 0 is used to indicate a
  1852.              normal exit, and a nonzero value indicates some errors.
  1853.  
  1854. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    35
  1855.  
  1856.  
  1857. FileExist
  1858. ──────────────────────────────────────────────────────────────────────────
  1859.  
  1860. Function     Determines if a file or directory is exist.
  1861.  
  1862. Syntax       FILEEXIST filename,existFlag
  1863.  
  1864. Remark       FILEEXIST checks the file named by <filename> to determines
  1865.              if it is exists.
  1866.  
  1867.              Wildcards are allowed in <filename>.
  1868.  
  1869. Return       If the file is exist, <existFlag> is set to TRUE; otherwise,
  1870.              <existFlag> is FALSE.
  1871.  
  1872. See also     Delete, Rename
  1873.  
  1874.  
  1875. FileSize
  1876. ──────────────────────────────────────────────────────────────────────────
  1877.  
  1878. Function     Gets file size in bytes.
  1879.  
  1880. Syntax       FILESIZE filename,size
  1881.  
  1882. Remark       FILESIZE returns the length, in bytes, of the file
  1883.              specified by <filename>.
  1884.  
  1885. Return       If <filename> exist, <size> is set to the file size and
  1886.              SUCCESS is set to TRUE; otherwise, SUCCESS is set to FALSE.
  1887.  
  1888. See also     Read, Seek
  1889.  
  1890.  
  1891. Get
  1892. ──────────────────────────────────────────────────────────────────────────
  1893.  
  1894. Function     Gets a string from remote system.
  1895.  
  1896. Syntax       GET s
  1897.  
  1898. Remark       GET collects a string, terminated by a carriage return, from
  1899.              the remote system.
  1900.  
  1901.              GET does not eliminate the BackSpace character [Ctrl H] from
  1902.              the input, therefore a CONCAT statement should be perform
  1903.              after the GET statement to eliminate the BackSpace character.
  1904.  
  1905. Return       <s> contains the collected string. The ending carriage return
  1906.              is discarded.
  1907.  
  1908.  
  1909. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    36
  1910.  
  1911.  
  1912. See also     Clear COM, ComInCount, GetCh
  1913.  
  1914. Example
  1915.  
  1916.      GET s               ; get a string from remote system
  1917.      filename = ""       ; prepare the variable
  1918.      CONCAT filename,s   ; eliminate the BackSpace
  1919.  
  1920.  
  1921. GetCh
  1922. ──────────────────────────────────────────────────────────────────────────
  1923.  
  1924. Function     Gets a character from remote system.
  1925.  
  1926. Syntax       GETCH ch
  1927.  
  1928. Remark       GETCH gets a single character from the remote system. If no
  1929.              character is available, GETCH return immediately. GETCH
  1930.              statement, like the INKEY$ function in BASIC, does not wait.
  1931.  
  1932. Return       If a character is successfully read into <ch>, SUCCESS is set
  1933.              to TRUE; otherwise, SUCCESS is set to FALSE.
  1934.  
  1935. See also     Get
  1936.  
  1937. Example
  1938.  
  1939.      REPEAT         ; to wait for a character,
  1940.         GETCH ch    ;  repeat the GETCH until
  1941.      UNTIL SUCCESS  ;  a character is available
  1942.  
  1943.  
  1944. HangUp
  1945. ──────────────────────────────────────────────────────────────────────────
  1946.  
  1947. Function     HangUps the modem.
  1948.  
  1949. Syntax       HANGUP
  1950.  
  1951. Remark       HANGUP sends the modem hangup string to modem. If the hangup
  1952.              string is the "^#" macro sequence, Telemate hangs up the
  1953.              modem by dropping DTR.
  1954.  
  1955.  
  1956. Image
  1957. ──────────────────────────────────────────────────────────────────────────
  1958.  
  1959. Function     Captures the terminal screen into an image file.
  1960.  
  1961. Syntax       IMAGE
  1962.              IMAGE filename
  1963.  
  1964. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    37
  1965.  
  1966.  
  1967. Remark       IMAGE captures the terminal screen into an image file by
  1968.              appending the screen to the file <filename>. If no <filename>
  1969.              is supplied, the last image filename is used.
  1970.  
  1971.  
  1972. Input
  1973. ──────────────────────────────────────────────────────────────────────────
  1974.  
  1975. Function     Reads a string from the keyboard.
  1976.  
  1977. Syntax       INPUT s
  1978.  
  1979. Remark       INPUT collects a string, terminated by a [Enter],
  1980.              from the keyboard.
  1981.  
  1982.              When the INPUT statement in the script is executed, the
  1983.              following input characters are placed in a keyboard buffer
  1984.              no matter if they are to be read or not. As a result, they
  1985.              NOT sent to the remote system automatically. It is important
  1986.              to give up the control of keyboard whenever no more keyboard
  1987.              input is needed using the CLEAR KEY statement.
  1988.  
  1989.              INPUT does not eliminate the BackSpace character [Ctrl H]
  1990.              from the input, therefore a CONCAT statement should be
  1991.              perform after the INPUT statement to elimate the BackSpace
  1992.              character.
  1993.  
  1994. Return       <s> contains the collected string. The ending [Enter] is
  1995.              discarded.
  1996.  
  1997. See also     Clear Key, InputCh
  1998.  
  1999. Example
  2000.  
  2001.      INPUT s             ; get a string from remote system
  2002.      filename = ""       ; prepare the variable
  2003.      CONCAT filename,s   ; eliminate the BackSpace
  2004.      CLEAR KEY           ; give up keyboard control such that
  2005.                          ;  following keys are sent to remote
  2006.                          ;  system automatically
  2007.  
  2008. InputCh
  2009. ──────────────────────────────────────────────────────────────────────────
  2010.  
  2011. Function     Reads a character from the keyboard.
  2012.  
  2013. Syntax       INPUTCH ch
  2014.  
  2015.  
  2016. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    38
  2017.  
  2018.  
  2019. Remark       INPUTCH gets a single character from the keyboard. If no
  2020.              character is available, INPUTCH returns immediately.
  2021.              INPUTCH statement, like the INKEY$ function in BASIC, does
  2022.              not wait.
  2023.  
  2024.              When the INPUTCH statement in the script is executed, the
  2025.              following input characters are placed in a keyboard buffer no
  2026.              matter if they are to be read or not. As a result, they are
  2027.              NOT sent to the remote system automatically. It is important
  2028.              to give up the control of keyboard whenever no more keyboard
  2029.              input is needed using the CLEAR KEY statement.
  2030.  
  2031. Return       If a character is successfully read into <ch>, SUCCESS is set
  2032.              to TRUE; otherwise, SUCCESS is set to FALSE.
  2033.  
  2034. See also     Clear Key, Input
  2035.  
  2036. Example
  2037.  
  2038.      REPEAT         ; to wait for a character,
  2039.         INPUTCH ch  ;  repeat the INPUTCH until
  2040.      UNTIL SUCCESS  ;  a character is available
  2041.      CLEAR KEY      ; give up keyboard control such that
  2042.                     ;  following keys are sent to remote
  2043.                     ;  system automatically
  2044.  
  2045. Itoa
  2046. ──────────────────────────────────────────────────────────────────────────
  2047.  
  2048. Function     Converts an integer to a string.
  2049.  
  2050. Syntax       ITOA i,s
  2051.  
  2052. Remark       ITOA converts the integer <i> to a string and store it into
  2053.              <s>.
  2054.  
  2055. Return       <s> contains the string representation of the value <i>.
  2056.  
  2057. See also     Atoi
  2058.  
  2059.  
  2060. Keystroke
  2061. ──────────────────────────────────────────────────────────────────────────
  2062.  
  2063. Function     Simulates keystrokes.
  2064.  
  2065. Syntax       KEYSTROKE s
  2066.  
  2067.  
  2068. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    39
  2069.  
  2070.  
  2071. Remark       KEYSTROKES simulates keystrokes as if they are generated by
  2072.              the keyboard, including [Alt] keys. It is equivalent to the
  2073.              '^-' keystroke simulation macro, except that the string <s>
  2074.              does not include the '^-' symbol.
  2075.  
  2076. Example
  2077.  
  2078.      KEYSTROKE "`1200`2e00`1400`1900"
  2079.  
  2080.      ; generates [Alt E] [Alt C] [Alt T] [Alt P] which switch to the
  2081.      ; editor, copy the marked text to the clipboard, switch to the
  2082.      ; terminal and paste the content in the clipboard to the remote
  2083.      ; system.
  2084.  
  2085.  
  2086. Length
  2087. ──────────────────────────────────────────────────────────────────────────
  2088.  
  2089. Function     Calculates the length of a string.
  2090.  
  2091. Syntax       LENGTH s,len
  2092.  
  2093. Return       <len> is the length of <s>. If <s> is an empty, <len>
  2094.              is 0.
  2095.  
  2096.  
  2097. LoadFon
  2098. ──────────────────────────────────────────────────────────────────────────
  2099.  
  2100. Function     Loads a phone directory.
  2101.  
  2102. Syntax       LOADFON phoneDir
  2103.  
  2104. Remark       LOADFON loads the <phoneDir> with extension .FON and the
  2105.              corresponding memo file .MEM into the dial window.
  2106.  
  2107.              If <phoneDir> does not include a directory, the Telemate
  2108.              directory is used. The extension .FON can be omitted.
  2109.  
  2110. Return       Upon successful completion, SUCCESS is set to TRUE; if
  2111.              <phoneDir> does not exist, SUCCESS is FALSE.
  2112.  
  2113. See also     Dial
  2114.  
  2115. Example
  2116.  
  2117.      LOADFON "LONGDIST.FON"
  2118.  
  2119.  
  2120.  
  2121. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    40
  2122.  
  2123.  
  2124. LoadKey
  2125. ──────────────────────────────────────────────────────────────────────────
  2126.  
  2127. Function     Loads a keyboard definition table.
  2128.  
  2129. Syntax       LOADKEY keyTable
  2130.  
  2131. Remark       LOADKEY loads the <keyTable> with extension .KEY.
  2132.  
  2133.              If <keyTable> does not include a directory, the Telemate
  2134.              directory is used. The extension .KEY can be omitted.
  2135.  
  2136. Return       Upon successful completion, SUCCESS is set to TRUE; if
  2137.              <keyTable> does not exist, SUCCESS is FALSE.
  2138.  
  2139. Example
  2140.  
  2141.      LOADKEY "EUROPE.KEY"
  2142.  
  2143.  
  2144. LoadMac
  2145. ──────────────────────────────────────────────────────────────────────────
  2146.  
  2147. Function     Loads a macro definition table.
  2148.  
  2149. Syntax       LOADMAC macroTable
  2150.  
  2151. Remark       LOADMAC loads the <macroTable>, with extension .MAC into
  2152.              the macro window.
  2153.  
  2154.              If <macroTable> does not include a directory, the Telemate
  2155.              directory is used. The extension .MAC can be omitted.
  2156.  
  2157. Return       Upon successful completion, SUCCESS is set to TRUE; if
  2158.              <macroTable> does not exist, SUCCESS is FALSE.
  2159.  
  2160. Example
  2161.  
  2162.      LOADMAC "CIS.MAC"
  2163.  
  2164.  
  2165. LoadPad
  2166. ──────────────────────────────────────────────────────────────────────────
  2167.  
  2168. Function     Loads a keypad definition table.
  2169.  
  2170. Syntax       LOADPAD keypadTable
  2171.  
  2172.  
  2173. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    41
  2174.  
  2175.  
  2176. Remark       LOADPAD loads the <keypadTable>, with extension .PAD into the
  2177.              macro window.
  2178.  
  2179.              If <keypadTable> does not include a directory, the Telemate
  2180.              directory is used. The extension .PAD can be omitted.
  2181.  
  2182. Return       Upon successful completion, SUCCESS is set to TRUE; if
  2183.              <keypadTable> does not exist, SUCCESS is FALSE.
  2184.  
  2185. Example
  2186.  
  2187.      LOADPAD "VT102DEL.PAD"
  2188.  
  2189.  
  2190. LogOff
  2191. ──────────────────────────────────────────────────────────────────────────
  2192.  
  2193. Function     Closes the log file.
  2194.  
  2195. Syntax       LOGOFF
  2196.  
  2197. Remark       LOGOFF closes a previous opened log file.
  2198.  
  2199. Return       LOGGING is set to 0 (FALSE).
  2200.  
  2201. See also     LogOn, LogPause, LogResume
  2202.  
  2203.  
  2204. LogOn
  2205. ──────────────────────────────────────────────────────────────────────────
  2206.  
  2207. Function     Opens a log file and captures incoming data into the file.
  2208.  
  2209. Syntax       LOGON
  2210.              LOGON filename
  2211.  
  2212. Remark       LOGON opens the log file <filename> and starts capturing the
  2213.              incoming data into it.
  2214.  
  2215.              If <filename> is not supplied, the filename specified in the
  2216.              last LOGON statement is used. If there is no prevous LOGON
  2217.              statement, the one in the log file field of the phone
  2218.              directory is used. If this field is empty, "TM.LOG" is used.
  2219.  
  2220. Return       Upon successful completion, SUCCESS is set to TRUE and
  2221.              LOGGING is set to 1 (TRUE); otherwise, SUCCESS is 0 (FALSE).
  2222.  
  2223. See also     LogOff, LogPause, LogResume
  2224.  
  2225.  
  2226.  
  2227. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    42
  2228.  
  2229.  
  2230. LogPause
  2231. ──────────────────────────────────────────────────────────────────────────
  2232.  
  2233. Function     Pauses capturing incoming data into the log file.
  2234.  
  2235. Syntax       LOGPAUSE
  2236.  
  2237. Remark       LOGPAUSE pauses capturing incoming data. The LOGGING variable
  2238.              should be checked to determine if a log file open. A value of
  2239.              1 indicates a log file is open.
  2240.  
  2241. Return       LOGGING is set to 2.
  2242.  
  2243. See also     LogOff, LogOn, LogResume
  2244.  
  2245.  
  2246. LogResume
  2247. ──────────────────────────────────────────────────────────────────────────
  2248.  
  2249. Function     Resumes capturing incoming data into the log file.
  2250.  
  2251. Syntax       LOGRESUME
  2252.  
  2253. Remark       LOGRESUME resumes capturing incoming data. The LOGGING
  2254.              variable should be checked to determine if the log file is in
  2255.              pause. A value of 2 indicates the log file is in pause.
  2256.  
  2257. Return       LOGGING is set to 1.
  2258.  
  2259. See also     LogOff, LogOn, LogPause
  2260.  
  2261.  
  2262. Open
  2263. ──────────────────────────────────────────────────────────────────────────
  2264.  
  2265. Function     Opens a text file for reading or writing.
  2266.  
  2267. Syntax       OPEN filename
  2268.  
  2269. Remark       OPEN opens the text file <filename> for reading and writing
  2270.              and strip the ending EOF [Ctrl Z].
  2271.  
  2272.              OPEN closes the previously open file automatically if no
  2273.              CLOSE command is issued to that file.
  2274.  
  2275. Return       Upon successful completion, SUCCESS is set to TRUE. If
  2276.              <filename> does not exist, SUCCESS is FALSE.
  2277.  
  2278. See also     Append, Close, Create, FileExist, FileSize, Read, Seek, Tell,
  2279.              Write
  2280.  
  2281.  
  2282. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    43
  2283.  
  2284.  
  2285. Example
  2286.  
  2287.      OPEN "MYFILE"       ; open the file "MYFILE"
  2288.      IF NOT SUCCESS      ; report if not found
  2289.         PRINT "File not found."
  2290.         STOP
  2291.      ENDIF
  2292.      READ s              ; read the first line
  2293.      PRINT s             ; print it
  2294.      CLOSE               ; close the file
  2295.  
  2296.      OPEN "FILE1"        ; open FILE1
  2297.      OPEN "FILE2"        ; close FILE1 and open FILE2
  2298.  
  2299.  
  2300. Print
  2301. ──────────────────────────────────────────────────────────────────────────
  2302.  
  2303. Function     Prints integers or strings to the terminal screen.
  2304.  
  2305. Syntax       PRINT
  2306.              PRINT s
  2307.              PRINT i
  2308.              PRINT s1,s2,i1,i2,s3, ...
  2309.              PRINT s1,s2,i1,i2,s3, ... ,
  2310.  
  2311. Remark       PRINT outputs variables or constants of integer or string to
  2312.              the terminal screen. Each two arguments are separated by a
  2313.              comma.
  2314.  
  2315.              PRINT supplies a newline by default. If a comma follows, no
  2316.              newline is supplied.
  2317.  
  2318. See also     At, WhereX, WhereY
  2319.  
  2320. Example
  2321.  
  2322.      PRINT "hello, world"   ; say hello to everyone
  2323.      PRINT "hello, ",       ; say that again
  2324.      PRINT "world",
  2325.      PRINT
  2326.  
  2327.      PRINT "x = ",x         ; output multiple strings or integers
  2328.      PRINT "My name is ",firstName," ",lastName
  2329.  
  2330.  
  2331.  
  2332. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    44
  2333.  
  2334.  
  2335. Put
  2336. ──────────────────────────────────────────────────────────────────────────
  2337.  
  2338. Function     Sends strings or integers to the remote system.
  2339.  
  2340. Syntax       PUT
  2341.              PUT s
  2342.              PUT i
  2343.              PUT s1,s2,i1,i2,s3, ...
  2344.              PUT s1,s2,i1,i2,s3, ... ,
  2345.  
  2346. Remark       Like the PRINT statement, PUT sends variables or constants of
  2347.              types integer or string to the remote system. Each two
  2348.              arguments are separated by a comma. Integers are converted to
  2349.              their string representation automatically before transmitting
  2350.              to the remote system.
  2351.  
  2352.              PUT supplies a carriage return [Ctrl M] by default. If a
  2353.              comma follows, no carriage return is supplied.
  2354.  
  2355.              Control characters can be sent by using the '^' prefix. For
  2356.              example, "^C" represents the [Ctrl C], "^M" the carriage
  2357.              return [Enter] and "^[" the Escape key [Esc].
  2358.  
  2359.              The following macro sequences have special meanings.
  2360.  
  2361.                   ^^     the character '^'
  2362.                   ^~     the character '~'
  2363.                   ~      pause 0.5 second
  2364.                   ^#     drop DTR signal to hangup modem
  2365.                   ^%     break signal
  2366.                   ^$     memo field in phone directory
  2367.                   ^&     password field in phone directory
  2368.                   ^*     modem hangup string
  2369.                   ^(     modem init string
  2370.                   ^)     modem answer string
  2371.  
  2372. See also     Clear COM, ComOutCount, Waitfor
  2373.  
  2374. Example
  2375.  
  2376.      PUT "first last"    ; transmit first name and last name
  2377.                          ;  then a carriage return (^M)
  2378.      PUT "first ",       ; same as above
  2379.      PUT "last",
  2380.      PUT
  2381.  
  2382.      PUT                 ; these two lines are
  2383.      PUT "^M",           ;  equivalent
  2384.  
  2385.  
  2386. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    45
  2387.  
  2388.  
  2389.      firstName = "first" ; set first and last name
  2390.      lastName = "last"
  2391.      password = "^&"     ; use the password field in TM.FON
  2392.      PUT firstName," ",lastName,"^M~~~~",password
  2393.             ; send name, [Enter], wait for 2 seconds then send
  2394.             ;  the password, [Enter]
  2395.  
  2396.      PUT "~^#~~^)",      ; wait 0.5 second, drop DTR,
  2397.                          ;  wait 1 second, then sends the
  2398.                          ;  modem answer string
  2399.  
  2400.  
  2401. Query
  2402. ──────────────────────────────────────────────────────────────────────────
  2403.  
  2404. Function     Queries option value.
  2405.  
  2406. Syntax       QUERY <OPTION>,<VALUE>
  2407.  
  2408. Remark       The QUERY statement gives you the ability to peek most of the
  2409.              system options.
  2410.  
  2411.              All the options that the SET command accept can be queried by
  2412.              the QUERY command. The returning value is the same as that in
  2413.              the SET command. In addition, the following options are
  2414.              accepted by the QUERY command:
  2415.  
  2416.      <OPTION>          <VALUE>     Description
  2417.      ─────────────     ────────    ──────────────────────────────────
  2418.      Board             "..."       return the board name of the
  2419.                                    connected entry
  2420.      Phone             "..."       return the phone number of the
  2421.                                    connected entry
  2422.      Password          "..."       return the password of the
  2423.                                    connected entry
  2424.      Total             nnn         return the total number of
  2425.                                    connection of the connected entry
  2426.      LastCall          "MM-DD-YY"  return the date of the connected
  2427.                                    entry
  2428.      Memo              "..."       return the memo of the connected
  2429.                                    entry
  2430.  
  2431.              This command should be used to store the value of an option
  2432.              before modifying the option and then restore the option to
  2433.              its original before the execution stops.
  2434.  
  2435. See also     Set
  2436.  
  2437.  
  2438. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    46
  2439.  
  2440.  
  2441. Example
  2442.  
  2443.      QUERY zAutoDownload,autoZmodem
  2444.      SET zAutoDownload,off
  2445.      RECEIVE "z"
  2446.      SET zAutoDownload,autoZmodem
  2447.  
  2448.      QUERY board,bbs
  2449.      QUERY password,pw
  2450.      QUERY memo,mm
  2451.      PRINT "#",CONNECTED,"   ",bbs,"   ",pw,"   ",mm
  2452.  
  2453.      QUERY diallist,list
  2454.      PRINT list
  2455.  
  2456.      QUERY connection,conn
  2457.      SWITCH conn
  2458.        CASE 0: PRINT "Modem"
  2459.        CASE 1: PRINT "Computer"
  2460.        CASE 2: PRINT "Fossil"
  2461.        CASE 3: PRINT "BIOS"
  2462.      ENDSWITCH
  2463.  
  2464.      QUERY parity,par
  2465.      SWITCH par
  2466.        CASE 0: PRINT "None"
  2467.        CASE 1: PRINT "Odd"
  2468.        CASE 2: PRINT "Even"
  2469.        CASE 3: PRINT "Space"
  2470.        CASE 4: PRINT "Mark"
  2471.      ENDSWITCH
  2472.  
  2473.      QUERY terminal,term
  2474.      SWITCH term
  2475.        CASE 0: PRINT "TTY"
  2476.        CASE 1: PRINT "ANSI"
  2477.        CASE 2: PRINT "VT52"
  2478.        CASE 3: PRINT "VT102"
  2479.        CASE 4: PRINT "AVATAR"
  2480.        CASE 5: PRINT "PRISM"
  2481.      ENDSWITCH
  2482.  
  2483.  
  2484. Read
  2485. ──────────────────────────────────────────────────────────────────────────
  2486.  
  2487. Function     Reads a string from a text file.
  2488.  
  2489. Syntax       READ s
  2490.  
  2491.  
  2492. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    47
  2493.  
  2494.  
  2495. Remark       READ reads characters from the file into <s>.
  2496.  
  2497.              READ does not place the newline sequence CR-LF into the
  2498.              string.
  2499.  
  2500. Return       On success, <s> contains the string read and SUCCESS is set
  2501.              to TRUE. SUCCESS is FALSE on end-of-file or error.
  2502.  
  2503. See also     Close, Open, ReadCh, Seek, Tell
  2504.  
  2505. Example
  2506.  
  2507.      OPEN "MYFILE"       ; count lines in the file MYFILE
  2508.      IF NOT SUCCESS
  2509.         PRINT "File not found."
  2510.         STOP             ; stop if file not found
  2511.      ENDIF
  2512.      n = 0               ; number of line = 0
  2513.      READ str            ; read a line
  2514.      WHILE SUCCESS       ; repeat until end of file
  2515.         n = n + 1        ; increase counter
  2516.         READ str         ; read the next string
  2517.      ENDWHILE
  2518.      CLOSE               ; close the file
  2519.      PRINT "There are ",n," lines in the file"
  2520.      OPEN "TM.FON"       ; read a record from the phone directory
  2521.      recno = 10          ; read the record #10
  2522.      reclen = 131        ; record length of a entry
  2523.      SEEK recno*reclen   ; seek to the record position
  2524.      READ record         ; read the record
  2525.      CLOSE
  2526.  
  2527.  
  2528. ReadCh
  2529. ──────────────────────────────────────────────────────────────────────────
  2530.  
  2531. Function     Reads a character from a text file.
  2532.  
  2533. Syntax       READCH ch
  2534.  
  2535. Remark       READCH reads a single character from the file into <ch>.
  2536.  
  2537.              In a text file, a CR [Ctrl M] followed by a LF [Ctrl J]
  2538.              indicates end-of-line.
  2539.  
  2540. Return       On success, <ch> contains the character read and SUCCESS is
  2541.              set to TRUE. SUCCESS is FALSE on end-of-file or error.
  2542.  
  2543. See also     Close, Open, ReadCh, Seek, Tell
  2544.  
  2545.  
  2546.  
  2547. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    48
  2548.  
  2549.  
  2550. Receive
  2551. ──────────────────────────────────────────────────────────────────────────
  2552.  
  2553. Function     Receives (Downloads) one or more files from the remote
  2554.              system.
  2555.  
  2556. Syntax       RECEIVE protocol
  2557.              RECEIVE protocol,filename
  2558.  
  2559. Remark       RECEIVE receives (download) one or more files from the remote
  2560.              system using the protocol <protocol>. <protocol> can be one
  2561.              of the following or the menu key for external protocol.
  2562.  
  2563.              <protocol>     Protocol        <filename> needed
  2564.              ──────────     ────────        ─────────────────
  2565.                 "Z"         Zmodem                 No
  2566.                 "Y"         Ymodem                 No
  2567.                 "G"         Ymodem-G               No
  2568.                 "B"         Batch Ymodem           No
  2569.                 "X"         Xmodem                 Yes
  2570.                 "O"         Xmodem-1K              Yes
  2571.                 "R"         Relaxed Xmodem         Yes
  2572.                 "T"         Telink                 No
  2573.                 "S"         SEAlink                No
  2574.                 "M"         Modem7                 No
  2575.                 "K"         Kermit                 No
  2576.                 "C"         CIS Quick B            No
  2577.                 "A"         ASCII                  Yes
  2578.  
  2579.              For protocols, such as Xmodem, which does not pass the name,
  2580.              <filename> should contains the name being received. Wildcards
  2581.              are not allowed. If <filename> is "" and <GuessFile> option
  2582.              is on, the guessing name is used.
  2583.  
  2584.              Zmodem has the ability to start automatically which is called
  2585.              Zmodem AutoDownload - the <zAutoDownload> option. To prevent
  2586.              the download starts before the command RECEIVE "Z" is issued,
  2587.              the <zAutoDownload> option should be turned off before
  2588.              telling the remote system to start the transfer.
  2589.  
  2590. Return       If the file transfer is successful, SUCCESS is set to TRUE;
  2591.              SUCCESS is FALSE if the transfer abort.
  2592.  
  2593.              For external protocols, SUCCESS is always set to TRUE.
  2594.  
  2595. See also     Send, Set GuessFile, Set zAutoDownload, Waitfor
  2596.  
  2597.  
  2598. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    49
  2599.  
  2600.  
  2601. Example
  2602.  
  2603.      RECEIVE "x","file.zip"   ; Xmodem needs the filename
  2604.      RECEIVE "y"              ; Ymodem doesn't
  2605.  
  2606.      RECIEVE "x",""           ; use the guessing name as filename
  2607.  
  2608.      QUERY zAutoDownload,auto ; store the auto download option
  2609.      SET zAutoDownload,off    ; you must turn it off before you tell
  2610.      WAITFOR "command",10     ;  the remote system to send the files,
  2611.      PUT "d z *.zip"          ;  otherwise, the system's AutoDownload
  2612.      RECEIVE "z"              ;  procedure will take the control and
  2613.                               ;  the RECEIVE command will return a
  2614.                               ;  wrong SUCCESS value, after the
  2615.      SET zAutoDownload,auto   ;  transfer, you may restore it
  2616.      IF SUCCESS
  2617.         PRINT "File received successfully"
  2618.      ELSE
  2619.         PRINT "File transfer aborted"
  2620.      ENDIF
  2621.  
  2622.  
  2623. Rename
  2624. ──────────────────────────────────────────────────────────────────────────
  2625.  
  2626. Function     Renames a file.
  2627.  
  2628. Syntax       RENAME oldname,newname
  2629.  
  2630. Remark       RENAME changes the name of a file from <oldname> to
  2631.              <newname>.
  2632.  
  2633.              Directories in <oldname> and <newname> need not be the same,
  2634.              therefore, RENAME can be used to move a file from one
  2635.              directory to another. Wildcards are not allowed.
  2636.  
  2637. Return       On successfully renameing the file, SUCCESS is set to TRUE;
  2638.              otherwise, SUCCESS is FALSE.
  2639.  
  2640. See also     Delete, FileExist
  2641.  
  2642.  
  2643. Script
  2644. ──────────────────────────────────────────────────────────────────────────
  2645.  
  2646. Function     Executes another script program.
  2647.  
  2648. Syntax       SCRIPT scriptName
  2649.  
  2650.  
  2651. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    50
  2652.  
  2653.  
  2654. Remark       SCRIPT terminates the execution of the current script and
  2655.              executes the script program <scriptName>.
  2656.  
  2657.              <scriptName> may not contain the extension part of a
  2658.              filename. If <scriptName> does not include a path, the Script
  2659.              directory is used.
  2660.  
  2661. Example
  2662.  
  2663.      SCRIPT "HOST" ; executes the HOST.SCR in the Script directory
  2664.  
  2665.  
  2666. Seek
  2667. ──────────────────────────────────────────────────────────────────────────
  2668.  
  2669. Function     Repositions the file pointer.
  2670.  
  2671. Syntax       SEEK filepos
  2672.  
  2673. Remark       SEEK sets the file pointer to the new position <filepos>. At
  2674.              the beginning of a file, the file pointer is 0.
  2675.  
  2676.              If <filepos> is -1, the file pointer is moved to the end of
  2677.              the file.
  2678.  
  2679. Return       If the pointer is successfully moved, SUCCESS is set to TRUE;
  2680.              otherwise, SUCCESS is FALSE.
  2681.  
  2682. See also     Read, ReadCh, Tell, Write
  2683.  
  2684. Example                                  
  2685.  
  2686.      ; suppose TM.FON is open, to read record #10 without changing
  2687.      ; the file position, the TELL statement should be used
  2688.      TELL filepos     ; store file position
  2689.      SEEK 10*131      ; move to record #10, each record is 131 bytes
  2690.      READ record      ; read the record
  2691.      SEEK filepos     ; move back to previous position
  2692.  
  2693.  
  2694. Send
  2695. ──────────────────────────────────────────────────────────────────────────
  2696.  
  2697. Function     Sends (uploads) one or more files to remote system.
  2698.  
  2699. Syntax       SEND protocol,filenames
  2700.  
  2701.  
  2702. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    51
  2703.  
  2704.  
  2705. Remark       SEND sends (uploads) one or more files to the remote system
  2706.              using the protocol <protocol>. <protocol> can be one of the
  2707.              following or the menu key for external protocol.
  2708.  
  2709.              <protocol>     Protocol        Send multiple files
  2710.              ──────────     ────────        ───────────────────
  2711.                 "Z"         Zmodem                 Yes
  2712.                 "Y"         Ymodem                 No
  2713.                 "G"         Ymodem-G               Yes
  2714.                 "B"         Batch Ymodem           Yes
  2715.                 "X"         Xmodem                 No
  2716.                 "O"         Xmodem-1K              No
  2717.                 "R"         Relaxed Xmodem         No
  2718.                 "T"         Telink                 Yes
  2719.                 "S"         SEAlink                Yes
  2720.                 "M"         Modem7                 Yes
  2721.                 "K"         Kermit                 Yes
  2722.                 "C"         CIS Quick B            Yes
  2723.                 "A"         ASCII                  No
  2724.  
  2725.              <filenames> is a list of filenames to be sent, wildcard
  2726.              characters '*' and '?' can be used. If <filename> is "" and
  2727.              <GuessFile> option is on, the guessing name is used. Multiple
  2728.              files are separated by a space. For example,
  2729.                 "\TM\TM210-1.ZIP \TM\TM\210-2.ZIP"
  2730.                 "*.ZIP \UTIL\*.EXE *.TXT"
  2731.  
  2732.              For protocols, such as Xmodem, which cannot transfer multiple
  2733.              files, only the first file in <filenames>.
  2734.  
  2735. Return       If the file transfer is successful, SUCCESS is set to TRUE;
  2736.              SUCCESS is FALSE if the transfer abort.
  2737.  
  2738.              For external protocols, SUCCESS is always set to TRUE.
  2739.  
  2740. See also     Receive, Set GuessFile, Waitfor
  2741.  
  2742. Example                                  
  2743.  
  2744.      SEND "z","a:*.zip b:*.zip"      ; Zmodem batch upload
  2745.      IF SUCCESS
  2746.         PRINT "File sent successfully"
  2747.      ELSE
  2748.         PRINT "File transfer aborted"
  2749.      ENDIF
  2750.  
  2751.  
  2752.  
  2753. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    52
  2754.  
  2755.  
  2756. Set
  2757. ──────────────────────────────────────────────────────────────────────────
  2758.  
  2759. Function     Sets option value.
  2760.  
  2761. Syntax       SET <OPTION>,<VALUE>
  2762.              SET <OPTION>,<TOKEN>
  2763.  
  2764. Remark       The SET statement gives you control over many of the system
  2765.              options. The possible options and values are listed below.
  2766.  
  2767.      <OPTION>          <VALUE>     Description
  2768.      ─────────────     ────────    ──────────────────────────────────
  2769.      AddLineFeed       0 / 1       when On, a line feed is supplied
  2770.                                    after a carriage return [Ctrl M]
  2771.                                    is received
  2772.      AddReturn         0 / 1       when On, a carriage return is
  2773.                                    supplied after a line feed is
  2774.                                    received
  2775.      AlarmSound        0 - 999     in second, amount of time that
  2776.                                    the alarm music is to be played
  2777.      AlarmTime         0 - 999     in second, amount of time that
  2778.                                    the alarm window is to be shown
  2779.      AltKeys           0 / 1       when Off, all [Alt] keys, [PgUp],
  2780.                                    [PgDn], [Ctrl Home] and [Ctrl PrtSc]
  2781.                                    are disabled
  2782.      AutoRedial        0 / 1       when On, the remaining in the
  2783.                                    dial list will be dialed upon
  2784.                                    carrier lost
  2785.      AutoStop          0 / 1       when On, the script will stop
  2786.                                    automatically upon carrier lost,
  2787.                                    this setting is reset to Off at
  2788.                                    the beginning of every script
  2789.      AutoWrap          0 / 1       when On, character after column 80
  2790.                                    is wrapped to the new line.
  2791.      Baud            300 - 115200  set baud rate (300,1200,2400,4800,
  2792.                                    9600,19200,38400,57600,115200)
  2793.      Bell              0 / 1       when Off, no bell when [Ctrl G]
  2794.                                    received
  2795.      Capture           0 / 1       when Off, the backscroll buffer
  2796.                                    stops capturing the incoming data
  2797.      CharPacing        0 - 99      in tenth second, amount of time
  2798.                                    that the Paste or ASCII upload
  2799.                                    pause when a character is sent
  2800.      ConfirmHangUp     0 / 1       when On, confirm if required if
  2801.                                    [Alt H] is pressed
  2802.      Connection        0 - 3       set the connection type
  2803.      Data              7 / 8       set data bits
  2804.  
  2805. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    53
  2806.  
  2807.  
  2808.      DateFormat        0 - 8       set the date format, note that
  2809.                                    this option does not affect
  2810.                                    the date format in the script
  2811.                                    language
  2812.      DestBs            0 / 1       set destructive backspace
  2813.      DialAttempt       0 - 999     the number of attempt that the
  2814.                                    dialing process will perform,
  2815.                                    0 to dial until connected
  2816.      DialList          "..."       set the dial list
  2817.      DialPause         0 - 999     in second, amount of time to be
  2818.                                    wait between two dials
  2819.      DialTime          0 - 999     in second, amount of time to be
  2820.                                    wait after a number is dialed
  2821.      DirEdit           "..."       set the edit directory
  2822.      DirDownload       "..."       set the download directory
  2823.      DirImage          "..."       set the image directory
  2824.      DirLog            "..."       set the log directory
  2825.      DirScript         "..."       set the script directory
  2826.      DirTelemate       "..."       set the telemate directory
  2827.      DirUpload         "..."       set the upload directory
  2828.      DirView           "..."       set the view directory
  2829.      DirWrite          "..."       set the write directory
  2830.      ExpandBlankLine   0 / 1       when On, blank lines are
  2831.                                    expanded to lines containing
  2832.                                    a space
  2833.      ExtAlarm          0 / 1       when On, external alarm is used
  2834.      ExtendedPacing    0 - 99      in tenth second, amount of time
  2835.                                    that the Put command or the macro
  2836.                                    keys pause when a character is
  2837.                                    sent
  2838.      GuessFile         0 / 1       when On, guessed name is put in
  2839.                                    the file selection box
  2840.      GuessInitial      0 / 1       when On, guessed initial is put
  2841.                                    in the quote string
  2842.      Incoming          0 / 1       set incoming translation
  2843.      LinePacing        0 - 99      in tenth second, amount of
  2844.                                    time that the Paste function
  2845.                                    pause when a [Ctrl M] is sent
  2846.      LocalEcho         0 / 1       when On, characters are
  2847.                                    displayed in the terminal
  2848.      LogFilter         0 / 1       when On, terminal emulation
  2849.                                    control characters are not
  2850.                                    recorded into the log file
  2851.      LogHeading        0 / 1       when On, a brief heading is
  2852.                                    inserted into the log file
  2853.                                    before recording the incoming
  2854.                                    data
  2855.      MaxDosShell       0 / 1       when On, Telemate swaps most of
  2856.                                    itself out during a DOS shell
  2857.  
  2858. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    54
  2859.  
  2860.  
  2861.      MultiLine         0 / 1       when On, board names similar to
  2862.                                    the board just connected are
  2863.                                    discarded from the dial list
  2864.      Music             0 / 1       when Off, the music string
  2865.                                    is not interpreted
  2866.      Outgoing          0 / 1       set outgoing translation
  2867.      PaceChar          0 - 255     in ASCII, the character to be
  2868.                                    wait before pasting each line,
  2869.                                    0 to disable this function
  2870.      Parity            0 - 4       set parity
  2871.      Port              1 - 8       set COM port number
  2872.      Prefix            1 - 4       set the dialing prefix
  2873.      Printer           0 / 1       when On, received data is
  2874.                                    sent to printer
  2875.                                    DOS shell
  2876.      QuoteString       "..."       set the quote string
  2877.      RtsCts            0 / 1       set RTS/CTS flow control
  2878.      ScreenSaver       0 - 99      set screen saver
  2879.      ScriptEcho        0 / 1       when Off, incoming text are not
  2880.                                    displayed on the screen
  2881.      Stop              1 / 2       set stop bits
  2882.      StripHighBit      0 / 1       when On, the 8th bit is stripped
  2883.                                    from the incoming data
  2884.      Suffix            1 - 4       set the dialing suffix
  2885.      SwapToDisk        0 / 1       when On, Telemate swaps part
  2886.                                    of itself to disk during DOS
  2887.                                    shell
  2888.      SwapToEms         0 / 1       when On, Telemate swaps part
  2889.                                    of itself to EMS/XMS during
  2890.      Tag               0 - 2       set the tag separator
  2891.      Terminal          0 - 5       set the terminal type
  2892.      UsageLog          0 / 1       set usage log
  2893.      XonXoff           0 / 1       set XON/XOFF flow control
  2894.                                    is received
  2895.      zASCII            0 / 1       when On, Zmodem indicates that
  2896.                                    the upload is a ASCII file
  2897.      zAutoDownload     0 / 1       when Off, Zmodem does not
  2898.                                    download automatically
  2899.      zRecovery         0 / 1       when Off, Zmodem does not
  2900.                                    recover aborted transfer
  2901.  
  2902.              Some options allow the use of tokens. Options accept either
  2903.              0 or 1 can use Off for 0 and On for 1. The following lists
  2904.              the options that tokens and the corresponding value of the
  2905.              token:
  2906.  
  2907.      Connection, Modem(0)/Computer(1)/Fossil(2)/BIOS(3)
  2908.      Parity, None(0)/Odd(1)/Even(2)/Space(3)/Mark(4)
  2909.      Terminal, TTY(0)/ANSI(1)/VT52(2)/VT102(3)/AVATAR(4)/PRISM(5)
  2910.      Tag, Space(0)/Crlf(1)/Comma(2)
  2911.  
  2912.  
  2913. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    55
  2914.  
  2915.  
  2916. See also     Alarm, Dial, Dos, Query, Receive, Send
  2917.  
  2918. Example
  2919.  
  2920.      baudRate = 2400
  2921.      SET baud,baudRate   ; set baud rate to 2400
  2922.      SET baud,2400       ; same as above
  2923.      SET incoming,on     ; turn on incoming translation
  2924.      SET terminal,VT102  ; set terminal type to VT102
  2925.  
  2926.  
  2927. Stop
  2928. ──────────────────────────────────────────────────────────────────────────
  2929.  
  2930. Function     Terminates the execution of the current script program.
  2931.  
  2932. Syntax       STOP
  2933.  
  2934. Remark       STOP is usually used when an error is encountered.
  2935.  
  2936. See also     ExitTelemate
  2937.  
  2938. Example
  2939.  
  2940.      OPEN "MYFILE"               ; open a file
  2941.      IF NOT SUCCESS
  2942.         PRINT "File not found."
  2943.         STOP                     ; terminate if file not found
  2944.      ENDIF
  2945.  
  2946.  
  2947. StrDel
  2948. ──────────────────────────────────────────────────────────────────────────
  2949.  
  2950. Function     Deletes characters from a string.
  2951.  
  2952. Syntax       STRDEL str,pos,count
  2953.  
  2954. Remark       STRDEL deletes <count> characters from the position <pos>
  2955.              of the string <str>.
  2956.  
  2957.              The first character position is 1.
  2958.  
  2959. Return       <str> contains the new string.
  2960.  
  2961. See also     Concat, Length, StrIns, StrPos, SetSet, SubStr
  2962.  
  2963.  
  2964. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    56
  2965.  
  2966.  
  2967. Example
  2968.  
  2969.      str = "abcXYZdef"
  2970.      STRDEL str,4,3      ; delete "XYZ"
  2971.      PRINT str           ; "abcdef"
  2972.  
  2973.  
  2974. StrIns
  2975. ──────────────────────────────────────────────────────────────────────────
  2976.  
  2977. Function     Inserts a string into another string.
  2978.  
  2979. Syntax       STRINS str,substr,pos
  2980.  
  2981. Remark       STRINS inserts a string <substr> into another string <str>
  2982.              at position <pos>.
  2983.  
  2984.              If <pos> is larger than the length of <str>, the gap is
  2985.              filled with spaces. The first character position is 1.
  2986.  
  2987. Return       <str> contains the new string.
  2988.  
  2989. See also     Concat, Length, StrDel, StrPos, SetSet, SubStr
  2990.  
  2991. Example
  2992.  
  2993.      str = "abcdef"
  2994.      STRINS str,"XYZ",4  ; insert "XYZ"
  2995.      PRINT str           ; "abcXYZdef"
  2996.  
  2997.      str = "abc"
  2998.      STRINS str,"xyz",10 ; <count> is larger than the length of <str>
  2999.      PRINT str           ; "abc      xyz"
  3000.  
  3001.  
  3002. StrPos
  3003. ──────────────────────────────────────────────────────────────────────────
  3004.  
  3005. Function     Scans a string for the occurrence of a given substring.
  3006.  
  3007. Syntax       STRPOS str,substr,pos
  3008.  
  3009. Remark       STRPOS scans <str> for the first occurrence of the substring
  3010.              <substr>.  Case is not sensitive.
  3011.  
  3012.              The first character position is 1.
  3013.  
  3014. Return       If <substr> is a substring of <str>, <pos> is the position of
  3015.              the substring; otherwise, <pos> is 0.
  3016.  
  3017. See also     Concat, Length, StrDel, StrIns, SetSet, SubStr
  3018.  
  3019. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    57
  3020.  
  3021.  
  3022. Example
  3023.  
  3024.      STRPOS "abcdef","def",pos
  3025.      PRINT pos                   ;  4
  3026.  
  3027.  
  3028. StrSet
  3029. ──────────────────────────────────────────────────────────────────────────
  3030.  
  3031. Function     Sets part of a string to a given character.
  3032.  
  3033. Syntax       STRSET str,ch,pos,count
  3034.  
  3035. Remark       STRSET sets the string <str> starting from position <pos>
  3036.              with <count> character <ch>.
  3037.  
  3038.              If <pos> is larger than the length of <str>, the gap is
  3039.              filled with spaces. The first character position is 1.
  3040.  
  3041. Return       <str> contains the new string.
  3042.  
  3043. See also     Concat, Length, StrDel, StrIns, SetPos, SubStr
  3044.  
  3045. Example
  3046.  
  3047.      str = "abc"
  3048.      STRSET str,"X",3,10
  3049.      PRINT str           ; "abXXXXXXXXXX"
  3050.  
  3051.  
  3052. SubStr
  3053. ──────────────────────────────────────────────────────────────────────────
  3054.  
  3055. Function     Returns a substring from a given string.
  3056.  
  3057. Syntax       SUBSTR src,pos,count,dest
  3058.  
  3059. Remark       SUBSTR returns a substring in the string <src> starting at
  3060.              <pos> of length <count> into the string <dest>.
  3061.  
  3062.              The first character position is 1.
  3063.  
  3064. Return       <dest> contains the substring.
  3065.  
  3066. See also     Concat, Length, StrDel, StrIns, SetPos, StrSet
  3067.  
  3068. Example
  3069.  
  3070.      SUBSTR "abcdef",1,3,dest
  3071.      PRINT dest                  ; "abc"
  3072.  
  3073.  
  3074. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    58
  3075.  
  3076.  
  3077. Tell
  3078. ──────────────────────────────────────────────────────────────────────────
  3079. Function     Returns the current file pointer.
  3080.  
  3081. Syntax       TELL filepos
  3082.  
  3083. Remark       TELL returns the current file pointer. <filepos> is measured
  3084.              in bytes from the beginning of the file. At the beginning of
  3085.              the file, <filepos> is 0.
  3086.  
  3087.              Sometime it is neccessary to open more than one file, you can
  3088.              implement it by storing the file position of the original
  3089.              file, then restore it after the other file operation is
  3090.              completed.
  3091.  
  3092. Return       <filepos> is the current file pointer.
  3093.  
  3094. See also     Seek, Read, Write
  3095.  
  3096. Example
  3097.  
  3098.      i = 1
  3099.      filepos = 0                 ; at at beginning of file
  3100.      WHILE i<=10
  3101.         OPEN "bbsname"           ; open data file
  3102.         SEEK filepos             ; move the previous position
  3103.         READ name                ; read a bbs name
  3104.         TELL filepose            ; store the current position
  3105.         CLOSE                    ; close the file
  3106.         PhoneFind name,number    ; find the board in TM.FON
  3107.                                  ;  suppose the PhoneFind procedure
  3108.                                  ;  open the TM.FON
  3109.         IF number<>0             ; yes, it is in TM.FON
  3110.            PRINT name," found is entry #",number
  3111.         ENDIF
  3112.      ENDWHILE
  3113.  
  3114.  
  3115. Time
  3116. ──────────────────────────────────────────────────────────────────────────
  3117.  
  3118. Function     Gets system time.
  3119.  
  3120. Syntax       TIME now
  3121.  
  3122. Remark       TIME fills the string <now> with the current time.
  3123.  
  3124.              Times can be compared with the usual '<', '>' and '='
  3125.              relational operator.
  3126.  
  3127.  
  3128. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    59
  3129.  
  3130.  
  3131. Return       <now> contains the system current date in HH:MM:SS 24 hour
  3132.              format.
  3133.  
  3134. See also     Date
  3135.  
  3136. Example
  3137.  
  3138.      TIME now
  3139.      IF now>"07:00:00" AND now<="07:59:59"
  3140.         PRINT "Good morning."
  3141.      ENDIF
  3142.  
  3143.  
  3144. Usage
  3145. ──────────────────────────────────────────────────────────────────────────
  3146.  
  3147. Function     Puts a string into the usage file.
  3148.  
  3149. Syntax       USAGE <usageString>
  3150.  
  3151. Remark       USAGES puts the string <usageString> into the usage file
  3152.              TM.USE. The current time and date are added to the beginning
  3153.              of the line automatically.
  3154.  
  3155. Example
  3156.  
  3157.      USAGE "Switching to Host mode"
  3158.  
  3159.  
  3160. Waitfor
  3161. ──────────────────────────────────────────────────────────────────────────
  3162.  
  3163. Function     Waits for one of the given strings from the remote
  3164.              system.
  3165.  
  3166. Syntax       WAITFOR t
  3167.              WAITFOR s1,s2, ... , sN
  3168.              WAITFOR s1,s2, ... , sN, t
  3169.  
  3170. Remark       The 'WAITFOR t' format set the default waiting time to <t>,
  3171.              in second. If <t> is 0, no time checking is performed. If
  3172.              <t> is -1, no time checking is performed, but the waiting
  3173.              time is considered to be exceeded when a key is hit.
  3174.  
  3175.              The 'WAITFOR s1,s2, ... , sN' format waits until one of the
  3176.              given string is received from the remote system or the
  3177.              default waiting time exceeded.
  3178.  
  3179.  
  3180. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    60
  3181.  
  3182.  
  3183.              The 'WAITFOR s1,s2, ... , sN,t' format set the default
  3184.              waiting time to <t>, in second and waits until one of the
  3185.              given string is received from the remote system or the
  3186.              waiting time exceeded.
  3187.  
  3188.              Case is not sensitive when comparing the given string with
  3189.              the characters received from the remote system.
  3190.  
  3191.              Sometimes the remote system need a slight delay between the
  3192.              prompt and the response, you can use DELAY or the "~" half-
  3193.              second marco before the PUT command.
  3194.  
  3195. Return       If the waiting time exceeded, FOUND is set to 0 (FALSE);
  3196.              otherwise, FOUND is set the string number of the matched
  3197.              string.
  3198.  
  3199. See also     Delay, Put, Receive, Send, WaitUntil, When, WhenIdle
  3200.  
  3201. Example
  3202.  
  3203.      WAITFOR "first",30        ; wait for "first" in 30 seconds
  3204.      IF NOT FOUND
  3205.         PRINT "Not found."     ; if not found, stop
  3206.         STOP
  3207.      ELSE
  3208.         DELAY 5
  3209.         PUT "my name"          ; else send the first and
  3210.      ENDIF                     ;  last names
  3211.  
  3212.      ; The following is usually placed at the end of a script file.
  3213.      ; It waits for disconnection and print which string is found.
  3214.      WAITFOR "NO CARRIER","thanks for calling","hang up now",0
  3215.      PRINT "Ending connection"
  3216.  
  3217.      ; The following simulates the AutoDownload feature for protocols
  3218.      ; does not support this feature.
  3219.      WAITFOR "Download protocol is",0
  3220.      WAITFOR "Xmodem","Ymodem","SEAlink",5
  3221.      IF FOUND
  3222.         SWITCH FOUND
  3223.            CASE 1: RECEIVE "x","" ; Xmodem, use guessing name
  3224.            CASE 2: RECEIVE "y"    ; Ymodem download
  3225.            CASE 3: RECEIVE "s"    ; SEAlink download
  3226.         ENDSWITCH
  3227.      ENDIF
  3228.  
  3229.  
  3230.  
  3231. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    61
  3232.  
  3233.  
  3234. WaitUntil
  3235. ──────────────────────────────────────────────────────────────────────────
  3236.  
  3237. Function     Waits until the specified time exceeded.
  3238.  
  3239. Syntax       WAITUNTIL t
  3240.  
  3241. Remark       WAITUNTIL pauses the execution and waits until the time <t>,
  3242.              in HH:MM:SS 24 hour format, exceeded.
  3243.  
  3244. See also     Wait
  3245.  
  3246. Example
  3247.  
  3248.      WAITUNTIL "23:10:30"  ; pause until 11:10:30pm.
  3249.  
  3250.  
  3251. When
  3252. ──────────────────────────────────────────────────────────────────────────
  3253.  
  3254. Function     Sends a response string to the remote system whenever a given
  3255.              string is matched.
  3256.  
  3257. Syntax       WHEN <waitString>,<resonseString>
  3258.              WHEN <waitString>,""
  3259.  
  3260. Remark       The WHEN statement is usually used in the beginning of the
  3261.              script file and it is active until the end of the script
  3262.              file.
  3263.  
  3264.              Whenever the <waitString> is received from the remote system,
  3265.              the <responseString> is transmitted. The response string can
  3266.              be changed. To cancel a WHEN statement, "" should be put in
  3267.              in <responseString>.
  3268.  
  3269.              Case is not sensitive when comparing the <waitString> with
  3270.              the characters received from the remote system.
  3271.  
  3272. See also     Waitfor, WhenIdle
  3273.  
  3274. Example
  3275.  
  3276.      WHEN "Press ENTER","^M"     ; set response strings
  3277.      WHEN "More [y,n]?","y^M"
  3278.      WAITFOR "main menu",0       ; wait for "main menu"
  3279.      WHEN "Press ENTER",""       ; cancel response string
  3280.      WHEN "More [y,n]?","n^M"    ; change response string
  3281.      REPEAT                      ; make the WHEN statements
  3282.      UNTIL NOT CONNECTED         ; active until disconnected.
  3283.  
  3284.  
  3285. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    62
  3286.  
  3287.  
  3288. WhenIdle
  3289. ──────────────────────────────────────────────────────────────────────────
  3290.  
  3291. Function     Sends a string to the remote system if there is no COM
  3292.              Input/Output in the specified time.
  3293.  
  3294. Syntax       WHENIDLE t,s
  3295.  
  3296. Remark       WHENIDLE monitors the COM Input/Output and sends the string
  3297.              <s> to the remote system if COM I/O is idle for the specified
  3298.              time <t>, in second.
  3299.  
  3300.              Like the WHEN statement, WHENIDLE is active until the end of
  3301.              the script program.
  3302.  
  3303.              <s> can contain macro sequence, such as "^*", the modem
  3304.              hangup string.
  3305.  
  3306.              If <t> is equal to 0 or <s> is a empty string, the WHENIDLE
  3307.              statement will be cancel.
  3308.  
  3309. See also     Waitfor, When
  3310.  
  3311. Example
  3312.  
  3313.      WAITFOR "message command",0 ; wait for command prompt
  3314.      PUT "r"                     ; read message
  3315.      WHENIDLE 30," ^H"           ; prevent inactive timeout
  3316.      REPEAT                      ; make the WHENIDLE statement
  3317.      UNTIL NOT CONNECTED         ; active until disconnected
  3318.  
  3319.      ; There are several usages of this command. The above example
  3320.      ; shows the way to prevent inactive timeout. However, it can
  3321.      ; also be used to handle inactive timeout in the host script
  3322.      ; mode.  For example,
  3323.  
  3324.      WHENIDLE 180,"Inactive timeout^M^J~^*"
  3325.  
  3326.      ; this command checks if the COM I/O is idle for 3 minuates,
  3327.      ; sends a timeout message to the user and, finally, sends the
  3328.      ; hangup string, the hangup macro sequence "^*", to the modem.
  3329.  
  3330.      ; Sometimes the phone line is too noisy that some characters
  3331.      ; cannot be received correctly. The worst case is that those
  3332.      ; characters appear in the WAITFOR string. To prevent inactive
  3333.      ; timeout or waste of connect time, the WHENIDLE can be used as
  3334.      ; follows.
  3335.  
  3336.  
  3337. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    63
  3338.  
  3339.  
  3340.      WHENIDLE 5,"^M"             ; send a carriage return if idle
  3341.                                  ; for 5 seconds
  3342.      WAITFOR "first name"        ; now start the log on sequence
  3343.      PUT "first last"
  3344.      WAITFOR "password"          ; send password macro
  3345.      PUT "^&"
  3346.      WHENIDLE 0,""               ; cancel the WHENIDLE statement
  3347.  
  3348.  
  3349. WhereX
  3350. ──────────────────────────────────────────────────────────────────────────
  3351.  
  3352. Function     Gives the horizontal cursor position within the terminal
  3353.              window.
  3354.  
  3355. Syntax       WHEREX column
  3356.  
  3357. Remark       WHEREX returns the x-coordinate of the terminal window. The
  3358.              left-most column is 0.
  3359.  
  3360. Return       <column> is the horizontal cursor position.
  3361.  
  3362. See also     At, WhereX
  3363.  
  3364.  
  3365. WhereY
  3366. ──────────────────────────────────────────────────────────────────────────
  3367.  
  3368. Function     Gives the vertical cursor position within the terminal
  3369.              window.
  3370.  
  3371. Syntax       WHEREY row
  3372.  
  3373. Remark       WHEREY returns the y-coordinate of the terminal window. The
  3374.              top-most row is 0.
  3375.  
  3376. Return       <row> is the vertical cursor position.
  3377.  
  3378. See also     At, WhereY
  3379.  
  3380.  
  3381. Write
  3382. ──────────────────────────────────────────────────────────────────────────
  3383.  
  3384. Function     Writes integers or strings to a text file.
  3385.  
  3386. Syntax       WRITE
  3387.              WRITE s
  3388.              WRITE i
  3389.              WRITE s1,s2,i1,i2,s3, ...
  3390.              WRITE s1,s2,i1,i2,s3, ... ,
  3391.  
  3392. TELEMATE SCRIPT                                  BUILT IN PROCEDURES    64
  3393.  
  3394.  
  3395. Remark       Like the PRINT statement, WRITE sends variables or constants
  3396.              of types integer or string to the remote system. Each two
  3397.              arguments are separated by a comma. Integers are converted to
  3398.              their string representation automatically before transmitting
  3399.              to the remote system.
  3400.  
  3401.              WRITE supplies a carriage return [Ctrl M] and a line feed
  3402.              [Ctrl J] by default. If a comma follows, no carriage return
  3403.              and line feed is supplied.
  3404.  
  3405. Return       Upon successful completion, SUCCESS is set to TRUE;
  3406.              otherwise, SUCCESS is FALSE.
  3407.  
  3408. See also     Read, Seek, Tell
  3409.  
  3410. Example
  3411.  
  3412.      CREATE "COUNT"      ; write a hundred line into "COUNT"
  3413.      counter = 1         ; initiate the counter
  3414.      WHILE counter<=100  ; repeat 100 times
  3415.         WRITE "This is line ",counter
  3416.      ENDWHILE
  3417.      CLOSE               ; close the file
  3418.  
  3419.      newname = "New board name                "
  3420.      OPEN "TM.FON"       ; change the name field of a record
  3421.      recno = 10          ; change the record #10
  3422.      reclen = 131        ; record length of a entry
  3423.      SEEK recno*reclen   ; seek to the record position
  3424.      WRITE newname,      ; write the name
  3425.      CLOSE
  3426.  
  3427. TELEMATE SCRIPT                                   TOOLBOX PROCEDURES    65
  3428.  
  3429.  
  3430. TOOLBOX PROCEDURES
  3431. ──────────────────────────────────────────────────────────────────────────
  3432.  
  3433.     The toolboxes are a collection of useful script procedures. They are
  3434.     written as a supplement of the built-in procedures. You may freely
  3435.     modify the procedures and you are encourage to share your experience
  3436.     with the other users.
  3437.  
  3438.     The first toolbox defines ANSI color codes and supplies useful video
  3439.     procedures. The second one includes three input procedures and four
  3440.     character-type-checking procedures. The third one provides a standard
  3441.     method to access the phone directory and calculates the difference
  3442.     between two date/time string.
  3443.  
  3444.     To use the toolboxes, you should add the lines
  3445.  
  3446.          #include "toolbox1.scr"         ,
  3447.          #include "toolbox2.scr"         and/or
  3448.          #include "toolbox3.scr"
  3449.  
  3450.     at the beginning of your script file. To reduce the size of the
  3451.     compiled script file, you should include only the toolbox(es) that
  3452.     contain the procedures you need.
  3453.  
  3454.  
  3455. Toolbox #1
  3456. ──────────────────────────────────────────────────────────────────────────
  3457.  
  3458.     This toolbox defines video color values, ANSI color codes and a set of
  3459.     video procedures which output to local screen and/or remote system.
  3460.  
  3461.     To use this toolbox, you should add the line
  3462.  
  3463.        #include "toolbox1.scr"       ; include the toolbox
  3464.        TRUE = 1                      ; define boolean value
  3465.        FALSE = 0                     ;  for your convenience
  3466.  
  3467.     at the beginning of your script file. This will increase the file size
  3468.     of the compiled script file .TMS by about 4K. To minimum the overhead,
  3469.     you should cut and paste the procedures that you used into your script
  3470.     file. For example, the <EchoBox> and <EchoBlock> procedures may be
  3471.     excluded.
  3472.  
  3473.  
  3474.  
  3475. TELEMATE SCRIPT                                   TOOLBOX PROCEDURES    66
  3476.  
  3477.  
  3478. Color Values and ANSI Color Codes
  3479. ──────────────────────────────────────────────────────────────────────────
  3480.     The following table shows the colors values and its corresponding
  3481.     foreground and background ANSI codes.
  3482.  
  3483.         Color    Symbolic    Foreground     Background
  3484.         Value    Name        ANSI code      ANSI code
  3485.       ──────────────────────────────────────────────────
  3486.           0      BLACK       FGBLACK        BKBLACK
  3487.           1      BLUE        FGBLUE         BKBLUE
  3488.           2      GREEN       FGGREEN        BKGREEN
  3489.           3      RED         FGRED          BKRED
  3490.           4      CYAN        FGCYAN         BKCYAN
  3491.           5      MAGENTA     FGMAGENTA      BKMAGENTA
  3492.           6      YELLOW      FGYELLOW       BKYELLOW
  3493.           7      WHITE       FGWHITE        BKWHITE
  3494.  
  3495.     You can use the symbolic names to access a color. For example, the
  3496.     statement
  3497.  
  3498.         PRINT FGYELLOW,BKBLUE
  3499.  
  3500.     to set the local color to yellow on blue. Or you can use the toolbox
  3501.     procedures EchoColor and EchoBkColor to set the color. For example,
  3502.  
  3503.         EchoColor YELLOW
  3504.         EchoBkColor BLUE
  3505.  
  3506.     have similar effect to the above.
  3507.  
  3508.  
  3509. EchoToLocal and EchoToRemote
  3510. ──────────────────────────────────────────────────────────────────────────
  3511.  
  3512.     The <EchoToLocol> and <EchoToRemote> variables tell the Echo
  3513.     procedures where the output is to be sent. If <EchoToLocal> is TRUE,
  3514.     the output is sent to the local screen, default is TRUE. If
  3515.     <EchoToRemote> is TRUE, the output is sent to the remote system,
  3516.     default is TRUE. These variables can both be TRUE.
  3517.  
  3518.  
  3519. Echo and EchoInt
  3520. ──────────────────────────────────────────────────────────────────────────
  3521. Function     Output a string or an integer to local screen and/or
  3522.              remote system.
  3523.  
  3524. Syntax       Echo s
  3525.              EchoInt i
  3526.  
  3527.  
  3528. TELEMATE SCRIPT                                   TOOLBOX PROCEDURES    67
  3529.  
  3530.  
  3531. Remark       ECHO outputs the string <s> while ECHOINT outputs the integer
  3532.              <i> to the local screen and/or remote system according to the
  3533.              the variables <EchoToLocal> and <EchoToRemote>.
  3534.  
  3535.              If <EchoToLocal> is TRUE, the output is sent to the local
  3536.              screen.
  3537.  
  3538.              If <EchoToRemote> is TRUE, the output is sent to the remote
  3539.              system.
  3540.  
  3541.              Both variables can both be TRUE. In this case, the output is
  3542.              sent to both the local screen and the remote system.
  3543.  
  3544.              All the procedures in this toolbox use these two procedures
  3545.              for output. As a result, the output destination depends on
  3546.              the varaibles <EchoToLocal> and <EchoToRemote> too.
  3547.  
  3548. Example
  3549.  
  3550.      TRUE  = 1           ; define boolean value
  3551.      FALSE = 0
  3552.  
  3553.      EchoToLocal = TRUE  ; echo to local screen
  3554.      EchoToRemote = FALSE;  but not to remote system
  3555.      Echo "This only display on local screen"
  3556.  
  3557.      EchoToRemoate = TRUE; now echo to remote system too
  3558.      EchoColor YELLOW    ; set yellow foreground
  3559.      EchoHiLite          ; high intensity
  3560.      EchoBkColor BLUE    ; set blue background
  3561.      Echo "Now both local screen and remote system is"
  3562.      Echo "yellow on blue"
  3563.  
  3564.  
  3565. EchoBkColor
  3566. ──────────────────────────────────────────────────────────────────────────
  3567.  
  3568. Function     Sets background color.
  3569.  
  3570. Syntax       ECHOBKCOLOR color
  3571.  
  3572. Remark       ECHOBKCOLOR sets the background color to <color> by outputing
  3573.              the corresponding background ANSI color code.
  3574.  
  3575.              <color> can be one of the following: BLACK, BLUE,GREEN, CYAN,
  3576.              RED, MAGENTA, YELLOW AND WHITE.
  3577.  
  3578. See also     EchoColor
  3579.  
  3580.  
  3581. TELEMATE SCRIPT                                   TOOLBOX PROCEDURES    68
  3582.  
  3583.  
  3584. Example
  3585.  
  3586.      EchoBkColor BLUE    ; blue background
  3587.  
  3588.      EchoColor BLACK     ; black on CYAN
  3589.      EchoBkColor CYAN
  3590.  
  3591.  
  3592. EchoBlink
  3593. ──────────────────────────────────────────────────────────────────────────
  3594.  
  3595. Function     Sets blink attribute.
  3596.  
  3597. Syntax       ECHOBLINK
  3598.  
  3599. See also     EchoHiLite, EchoNormal, EchoReverse
  3600.  
  3601. Example
  3602.  
  3603.      EchoColor GREEN     ; green foreground
  3604.      EchoBlink           ; blink
  3605.  
  3606.  
  3607. EchoBlock
  3608. ──────────────────────────────────────────────────────────────────────────
  3609.  
  3610. Function     Draws a solid block of a character.
  3611.  
  3612. Syntax       ECHOBLOCK left,top,right,bottom,style,fillchar
  3613.  
  3614. Remark       ECHOBLOCK draws a filled-in, rectangular block.
  3615.  
  3616.              The upper left and lower right corners of the rectangle are
  3617.              given by (left,top) and (right,bottom). The top-left corner
  3618.              is (0,0).
  3619.  
  3620.              <style> selects the type of block
  3621.                    0     spaces                      ' '
  3622.                    1     widely spaced block         '░'
  3623.                    2     spaced block                '▒'
  3624.                    3     closely spaced block        '▓'
  3625.                    4     solid block                 '█'
  3626.                    5     user-defined fill character <fillchar>
  3627.  
  3628.              <fillchar> should be set to "" for <style> not equal to 5.
  3629.  
  3630. See also     EchoBox
  3631.  
  3632.  
  3633. TELEMATE SCRIPT                                   TOOLBOX PROCEDURES    69
  3634.  
  3635.  
  3636. Example
  3637.  
  3638.      EchoBlock 5,10,50,15,3,""   ; fill a block with closely spaced
  3639.                                  ;  block '▓'
  3640.      EchoBlock 0,0,79,24,5,"▀"   ; fill the screen with thick
  3641.                                  ;  horizontal line '▀▀▀▀▀▀▀▀'
  3642.  
  3643.  
  3644. EchoBox
  3645. ──────────────────────────────────────────────────────────────────────────
  3646.  
  3647. Function     Draws a box.
  3648.  
  3649. Syntax       ECHOBOX left,top,right,bottom,style,fillchar,hollow
  3650.  
  3651. Remark       ECHOBOX draws a rectangular box.
  3652.  
  3653.              The upper left and lower right corners of the rectangle are
  3654.              given by (left,top) and (right,bottom). The top-left corner
  3655.              is (0,0).
  3656.  
  3657.              <style> selects the type of block
  3658.                    0     spaces
  3659.                    1     single line
  3660.                    2     double line
  3661.                    3     single vertical line, double horizontal line
  3662.                    4     double vertical line, single horizontal line
  3663.                    5     user-defined fill character <fillchar>
  3664.  
  3665.              <fillchar> should be set to "" for <style> not equal to 5.
  3666.  
  3667.              If <hollow> is TRUE, the inside of the box is cleared.
  3668.  
  3669. See also     EchoBlock
  3670.  
  3671. Example
  3672.  
  3673.      EchoBox 5,10,50,15,2,"",1   ; draw a double-line box and
  3674.                                  ;  clear the inside of it
  3675.      EchoBox 0,0,79,24,5,"█",0   ; draw a solid border but do not
  3676.                                  ;  clear the center
  3677.  
  3678.  
  3679. EchoClearScreen
  3680. ──────────────────────────────────────────────────────────────────────────
  3681.  
  3682. Function     Clears the screen and home cursor.
  3683.  
  3684. Syntax       ECHOCLEARSCREEN
  3685.  
  3686.  
  3687. TELEMATE SCRIPT                                   TOOLBOX PROCEDURES    70
  3688.  
  3689.  
  3690. Remark       ECHOCLEARSCREEN clears the screen with the current color and
  3691.              positions cursor to the top-left corner.
  3692.  
  3693. See also     EchoColor, EchoBkColor
  3694.  
  3695.  
  3696. EchoColor
  3697. ──────────────────────────────────────────────────────────────────────────
  3698.  
  3699. Function     Sets foreground color.
  3700.  
  3701. Syntax       ECHOCOLOR color
  3702.  
  3703. Remark       ECHOCOLOR sets the foreground color to <color> by outputing
  3704.              the corresponding foreground ANSI color code.
  3705.  
  3706.              <color> can be one of the following: BLACK, BLUE, GREEN,
  3707.              CYAN, RED, MAGENTA, YELLOW AND WHITE.
  3708.  
  3709. See also     EchoBkColor
  3710.  
  3711. Example
  3712.  
  3713.      EchoColor YELLOW    ; yellow foreground
  3714.  
  3715.      EchoColor BLACK     ; black on white
  3716.      EchoBkColor WHITE
  3717.  
  3718.  
  3719. EchoGotoXY
  3720. ──────────────────────────────────────────────────────────────────────────
  3721.  
  3722. Function     Positions cursor.
  3723.  
  3724. Syntax       ECHOGOTOXY column,row
  3725.  
  3726. Remark       ECHOGOTOXY moves the cursor to the position (column,row). The
  3727.              upper left corner is (0,0) and the lower right corner is
  3728.              (79,24) if a 25 rows terminal is used.
  3729.  
  3730.  
  3731. EchoHiLite
  3732. ──────────────────────────────────────────────────────────────────────────
  3733.  
  3734. Function     Sets high intensity.
  3735.  
  3736. Syntax       ECHOHILITE
  3737.  
  3738. See also     EchoBlink, EchoNormal, EchoReverse
  3739.  
  3740.  
  3741. TELEMATE SCRIPT                                   TOOLBOX PROCEDURES    71
  3742.  
  3743.  
  3744. Example
  3745.  
  3746.      EchoColor GREEN     ; green foreground
  3747.      EchoHiLite          ; light green
  3748.  
  3749.  
  3750. EchoNormal
  3751. ──────────────────────────────────────────────────────────────────────────
  3752.  
  3753. Function     Sets normal intensity and reset color to white on black.
  3754.  
  3755. Syntax       ECHONORMAL
  3756.  
  3757. Remark       ECHONORMAL not only set the normal intensity, but also reset
  3758.              the current color to white on black. There is no ANSI code to
  3759.              turn off high intensity.
  3760.  
  3761.              To turn off high intensity only, three statements must be
  3762.              used. You should keep track of the <foreground> and
  3763.              <background> color.
  3764.                  EchoNormal
  3765.                  EchoColor   foreground
  3766.                  EchoBkColor background
  3767.  
  3768. See also     EchoBlink, EchoHiLite, EchoReverse
  3769.  
  3770.  
  3771. EchoReverse
  3772. ──────────────────────────────────────────────────────────────────────────
  3773.  
  3774. Function     Sets reverse attribute.
  3775.  
  3776. Syntax       ECHOREVERSE
  3777.  
  3778. See also     EchoBlink, EchoHiLite, EchoNormal
  3779.  
  3780. Example
  3781.  
  3782.      EchoColor YELLOW    ; yellow on blue
  3783.      EchoBkColor BLUE
  3784.      EchoReverse         ; blue on yellow
  3785.  
  3786.  
  3787.  
  3788. TELEMATE SCRIPT                                   TOOLBOX PROCEDURES    72
  3789.  
  3790.  
  3791. Toolbox #2
  3792. ──────────────────────────────────────────────────────────────────────────
  3793.  
  3794.     This toolbox defines three I/O procedures and four character-type-
  3795.     checking procedures.
  3796.  
  3797.     To use this toolbox, you should add the line
  3798.        #include "toolbox2.scr" at the beginning of your script file. This
  3799.     will increase the file size of the compiled script file .TMS by about
  3800.     2K. To minimum the overhead, you should cut and paste the procedures
  3801.     that you used into your script file. For example, the <InputN> and
  3802.     <ReadN> procedures may be excluded.
  3803.  
  3804.  
  3805. GetN
  3806. ──────────────────────────────────────────────────────────────────────────
  3807.  
  3808. Function     Gets one or more characters from remote system.
  3809.  
  3810. Syntax       GETN s,n
  3811.  
  3812. Remark       GETN gets <n> characters from remote system or until CR
  3813.              [Ctrl M] is encountered.
  3814.  
  3815.              The input characters are displayed on local screen.
  3816.  
  3817.              BackSpace character [Ctrl H] deletes the last character of
  3818.              the inputing string. You should leave a space before your
  3819.              input prompt.
  3820.  
  3821.              The CLEAR KEY should be issued if you no longer need keyboard
  3822.              input.
  3823.  
  3824. Return       <s> contains the input string. If the length of <s> is less
  3825.              than <n>, CR is encountered.
  3826.  
  3827. See also     Clear COM, Get, GetCh
  3828.  
  3829. Example
  3830.  
  3831.      PUT "Press a key to continue"
  3832.      GetN enter,1        ; wait for a key or [Enter]
  3833.  
  3834.      ; Note: a space is required here ------------v for backspace
  3835.      PUT "Enter the filename you want to download: "
  3836.      GetN filename,50    ; let it handle backspace
  3837.  
  3838.  
  3839.  
  3840. TELEMATE SCRIPT                                   TOOLBOX PROCEDURES    73
  3841.  
  3842.  
  3843. InputN
  3844. ──────────────────────────────────────────────────────────────────────────
  3845.  
  3846. Function     Gets one or more characters from keyboard.
  3847.  
  3848. Syntax       INPUTN s,n
  3849.  
  3850. Remark       INPUTN gets <n> characters from keyboard or until [Enter] is
  3851.              pressed.
  3852.  
  3853.              BackSpace character [Ctrl H] deletes the last character of
  3854.              the inputing string.
  3855.  
  3856. Return       <s> contains the input string. If the length of <s> is less
  3857.              than <n>, [Enter] is pressed.
  3858.  
  3859. See also     At, Clear Key, Input, InputCh
  3860.  
  3861. Example
  3862.  
  3863.      PRINT "Press a key to continue"
  3864.      InputN enter,1      ; wait for a key or [Enter]
  3865.  
  3866.      PRINT "Enter the filename you want to display: "
  3867.      InputN filename,50  ; let it handle backspace
  3868.  
  3869.  
  3870. ReadN
  3871. ──────────────────────────────────────────────────────────────────────────
  3872.  
  3873. Function     Gets one or more characters from a file.
  3874.  
  3875. Syntax       READN s,n
  3876.  
  3877. Remark       READN gets <n> characters from the file or until the CR-LF
  3878.              newline sequence is encountered. The CR-LF is skipped in
  3879.              the file and discarded in the string.
  3880.  
  3881.              BackSpace character [Ctrl H] DOES NOT delete the last
  3882.              character of the inputing string.
  3883.  
  3884.              This procedure is usually used to get a field from a data
  3885.              file.
  3886.  
  3887. Return       <s> contains the input string. If the length of <s> is less
  3888.              than <n>, newline is encountered.
  3889.  
  3890. See also     Read, ReadCh, Seek, Tell
  3891.  
  3892.  
  3893. TELEMATE SCRIPT                                   TOOLBOX PROCEDURES    74
  3894.  
  3895.  
  3896. Example
  3897.  
  3898.      OPEN "TM.FON"       ; open the phone directory
  3899.      SEEK 10*131         ; move to entry #10, each entry is 131 bytes
  3900.      ReadN name,30       ; read the name field
  3901.      CLOSE               ; close the phone directory
  3902.  
  3903.  
  3904. isalpha
  3905. ──────────────────────────────────────────────────────────────────────────
  3906.  
  3907. Function     Determines if a character is a letter.
  3908.  
  3909. Syntax       ISALPHA ch,result
  3910.  
  3911. Return       If <ch> is a letter, <result> is set to TRUE; otherwise
  3912.              <result> is FALSE.
  3913.  
  3914. See also     isalnum, iscntl, isdigit
  3915.  
  3916. Example
  3917.  
  3918.      InputN ch,1         ; get one character
  3919.      PRINT
  3920.      isalpha ch,result
  3921.      IF result
  3922.         PRINT "yes, it is a letter"
  3923.      ELSE
  3924.         PRINT "no, it is not"
  3925.      ENDIF
  3926.  
  3927.  
  3928. isalnum
  3929. ──────────────────────────────────────────────────────────────────────────
  3930.  
  3931. Function     Determines if a character is a letter or a digit.
  3932.  
  3933. Syntax       ISALNUM ch,result
  3934.  
  3935. Return       If <ch> is a letter or a digit, <result> is set to TRUE;
  3936.              otherwise <result> is FALSE.
  3937.  
  3938. See also     isalpha, iscntl, isdigit
  3939.  
  3940.  
  3941. iscntl
  3942. ──────────────────────────────────────────────────────────────────────────
  3943.  
  3944. Function     Determines if a character is a control character.
  3945.  
  3946. Syntax       ISCNTL ch,result
  3947.  
  3948. TELEMATE SCRIPT                                   TOOLBOX PROCEDURES    75
  3949.  
  3950.  
  3951. Return       If <ch> is a control character ([Ctrl A] to [Ctrl Z]),
  3952.              <result> is set to TRUE; otherwise <result> is FALSE.
  3953.  
  3954. See also     isalpha, isalnum, isdigit
  3955.  
  3956.  
  3957. isdigit
  3958. ──────────────────────────────────────────────────────────────────────────
  3959.  
  3960. Function     Determines if a character is a digit.
  3961.  
  3962. Syntax       ISDIGHT ch,result
  3963.  
  3964. Return       If <ch> is a digit, <result> is set to TRUE; otherwise
  3965.              <result> is FALSE.
  3966.  
  3967. See also     isalpha, isalnum, iscntl
  3968.  
  3969.  
  3970. Toolbox #3
  3971. ──────────────────────────────────────────────────────────────────────────
  3972.  
  3973.     This toolbox defines several procedures to access the phone directory
  3974.     and two procedures to calculate the difference between two date/time
  3975.     strings.
  3976.  
  3977.     To use this toolbox, you should add the line
  3978.        #include "toolbox3.scr" at the beginning of your script file. This
  3979.     will increase the file size of the compiled script file .TMS by about
  3980.     5K. To minimum the overhead, you should cut and paste the procedures
  3981.     that you used into your script file. For example, the <DiffTime> and
  3982.     <DiffDate> procedures may be excluded.
  3983.  
  3984.  
  3985. ConvertDate
  3986. ──────────────────────────────────────────────────────────────────────────
  3987.  
  3988. Function     Converts one date format to another date format.
  3989.  
  3990. Syntax       CONVERTDATE format1,date1,format2,date2
  3991.  
  3992. Remark       CONVERTDATE converts the date string <date1> of data format
  3993.              integer <format1> to <date2> of <format2>.
  3994.  
  3995.  
  3996. TELEMATE SCRIPT                                   TOOLBOX PROCEDURES    76
  3997.  
  3998.  
  3999. Return       <date2> is the equivalent date of the <date1> but <date2> is
  4000.              in date format <format2> and <date1> is in date format
  4001.              <format2>.
  4002.  
  4003.              TMScript only recognizes date string in MM-DD-YY format (i.e.
  4004.              format 0). If you change the date format, it is important
  4005.              to convert it back to the MM-DD-YY before passing it into
  4006.              TMScript internal command, for example comparing two date
  4007.              strings.
  4008.  
  4009. See also     Date
  4010.  
  4011. Example
  4012.  
  4013.      DATE today0         ; MM-DD-YY (date format 0)
  4014.  
  4015.      ConvertDate 0,today0,1,today1
  4016.      PRINT today1        ; convert it to DD-MM-YY (date format 1)
  4017.  
  4018.      ConvertDate 1,today1,0,today0
  4019.      PRINT today0        ; back to MM-DD-YY (date format 0)
  4020.  
  4021.  
  4022. DiffDate
  4023. ──────────────────────────────────────────────────────────────────────────
  4024.  
  4025. Function     Computes the difference between two dates.
  4026.  
  4027. Syntax       DIFFDATE date1,date2,days
  4028.  
  4029. Remark       DIFFDATE calculates the elapsed days from <date1> to
  4030.             <date2> as if
  4031.                  <days> = <date2> - <date1>
  4032.  
  4033.              <date1> and <date2> must be in MM-DD-YY format.
  4034.  
  4035. Return       <days> is the elapsed days from <date1> to <date2>. <days>
  4036.              is always a non-negative integer.
  4037.  
  4038.              If <date1> is equal to <date2>, <days> is equal 0.
  4039.  
  4040.              If <date1> is larger than <date2>, it is assumed that <date2>
  4041.              pass a century and 100 years is added to <date2> before the
  4042.              calculation.
  4043.  
  4044. See also     Date, DiffTime
  4045.  
  4046.  
  4047. TELEMATE SCRIPT                                   TOOLBOX PROCEDURES    77
  4048.  
  4049.  
  4050. Example
  4051.  
  4052.      DiffDate "02-01-88","02-01-89",days
  4053.      PRINT days          ; 366
  4054.  
  4055.      DiffDate "02-01-91","03-01-91",days
  4056.      PRINT days          ; 28
  4057.  
  4058.      DiffDate "12-31-99","01-01-00",days ; 1999 - 2000
  4059.      PRINT days          ; 1
  4060.  
  4061.  
  4062. DiffTime
  4063. ──────────────────────────────────────────────────────────────────────────
  4064.  
  4065. Function     Computes the difference between two times.
  4066.  
  4067. Syntax       DIFFTIME time1,time2,seconds
  4068.  
  4069. Remark       DIFFTIME calculates the elapsed seconds from <time1> to
  4070.              <time2> as if
  4071.                  <seconds> = <time2> - <time1>
  4072.  
  4073.              <time1> and <time2> must be in HH:MM:SS format.
  4074.  
  4075. Return       <seconds> is the elapsed seconds from <time1> to <time2>.
  4076.              <seconds> is always a non-negative integer.
  4077.  
  4078.              If <time1> is equal to <time2>, <seconds> is equal 0.
  4079.  
  4080.              If <time1> is larger than <time2>, it is assumed that <time2>
  4081.              pass midnight and 24 hours is added to <time2> before the
  4082.              calculation.
  4083.  
  4084. See also     DiffDate, Time
  4085.  
  4086. Example
  4087.  
  4088.      DiffTime "12:30:40","12:31:30",seconds
  4089.      PRINT seconds       ; 50
  4090.  
  4091.      DiffTime "23:59:50","00:00:01",seconds  ; pass mid-night
  4092.      PRINT seconds       ; 11
  4093.  
  4094.  
  4095.  
  4096. TELEMATE SCRIPT                                   TOOLBOX PROCEDURES    78
  4097.  
  4098.  
  4099. PhoneDirectory
  4100. ──────────────────────────────────────────────────────────────────────────
  4101.  
  4102.     The <PhoneDirectory> variable tells the Phone's procedures which phone
  4103.     directory is to be access. Default is the "TM.FON".
  4104.  
  4105. Example
  4106.  
  4107.      PhoneDirectory = "MYPHONE.FON"
  4108.      PhoneFind "South",number,1  ; search the word "South" in
  4109.                                  ; MYPHONE.FON
  4110.  
  4111.  
  4112. PhoneFind
  4113. ──────────────────────────────────────────────────────────────────────────
  4114.  
  4115. Function     Finds a phone directory entry.
  4116.  
  4117. Syntax       PHONEFIND name,number,startPoint
  4118.  
  4119. Remark       PHONEFIND finds an entry by <name> starting from
  4120.              <startPoint>.
  4121.  
  4122. Return       If <name> matches an entry, <number> is set the entry number;
  4123.              otherwise, <number> is 0.
  4124.  
  4125.              <success> is FALSE if the phone directory cannot be open.
  4126.  
  4127. Caution      This procedure will close the formly opened file since the
  4128.              OPEN command is used. You should close the file before
  4129.              issuing this procedure and reopen the file after this
  4130.              procedure.
  4131.  
  4132. See also     PhoneDirectory, PhoneRead, PhoneSize, PhoneWrite
  4133.  
  4134. Example
  4135.  
  4136.      ; To start from the beginning of the phone directory
  4137.      PhoneFind "South",number,1
  4138.      IF NOT FOUND
  4139.         PRINT "String not found"
  4140.         STOP
  4141.      ENDIF
  4142.  
  4143.      PhoneRead number,name,password,link,log,phone,total,last
  4144.      PRINT "...."
  4145.  
  4146.      ; To go on search, supply <startPoint> with the next number
  4147.      PhoneFind "South",number,number+1
  4148.      PRINT "...."
  4149.  
  4150.  
  4151. TELEMATE SCRIPT                                   TOOLBOX PROCEDURES    79
  4152.  
  4153.  
  4154. PhoneRead
  4155. ──────────────────────────────────────────────────────────────────────────
  4156.  
  4157. Function     Reads a phone directory entry
  4158.  
  4159. Syntax       PHONEREAD number,name,password,linkscript,logfile,phone,
  4160.                        total,last
  4161.  
  4162. Remark       PHONEREAD reads the entry # <number> into the variables.
  4163.              <total> is an integer variable. The others are string
  4164.              variables.
  4165.  
  4166.              You must provide a valid entry <number>. The size of the
  4167.              phone directory can be obtained by the PHONESIZE procedure.
  4168.  
  4169. Return       <name> is the name field,
  4170.              <password> is the password field,
  4171.              <linkscript> is the script field,
  4172.              <logfile> is the log file field,
  4173.              <phone> is the phone number,
  4174.              <total> is the total number connected, an integer,
  4175.              <last> is the last logon date.
  4176.              Tailing spaces in each variables are discarded.
  4177.  
  4178.              <success> is FALSE if the phone directory cannot be open.
  4179.  
  4180. Caution      This procedure will close the formly opened file since the
  4181.              OPEN command is used. You should close the file before
  4182.              issuing this procedure and reopen the file after this
  4183.              procedure.
  4184.  
  4185. See also     PhoneDirectory, PhoneFind, PhoneSize, PhoneWrite
  4186.  
  4187. Example
  4188.  
  4189.      PhoneSize size              ; get the size
  4190.      number = 1                  ; start the counter
  4191.      WHILE number <= size        ; display all entries
  4192.         PhoneRead number,name,password,link,log,phone,total,last
  4193.         PRINT "BBS name:",name," phone:",phone," last on:",last
  4194.         number = number + 1      ; next entry
  4195.      ENDIF
  4196.  
  4197.  
  4198. PhoneSize
  4199. ──────────────────────────────────────────────────────────────────────────
  4200.  
  4201. Function     Gets the number of entries in a phone directory.
  4202.  
  4203. Syntax       PHONESIZE size
  4204.  
  4205.  
  4206. TELEMATE SCRIPT                                   TOOLBOX PROCEDURES    80
  4207.  
  4208.  
  4209. Remark       PHONESIZE calculated the phone directory size by
  4210.                <size> = <file size of .fon> / 131
  4211.              Each entries is 131 bytes.
  4212.  
  4213. Return       <success> is FALSE if the phone directory cannot be open.
  4214.  
  4215. See also     PhoneDirectory, PhoneFind, PhoneRead, PhoneWrite
  4216.  
  4217.  
  4218. PhoneWrite
  4219. ──────────────────────────────────────────────────────────────────────────
  4220.  
  4221. Function     Writes a phone directory entry
  4222.  
  4223. Syntax       PHONEWRITE number,name,password,linkscript,logfile,
  4224.                         phone,total,last
  4225.  
  4226. Remark       PHONEWRITE writes the entry # <number> from the variables.
  4227.              <total> is an integer variable. The others are string.
  4228.  
  4229.              <name> is the name field,
  4230.              <password> is the password field,
  4231.              <linkscript> is the script field,
  4232.              <logfile> is the log file field,
  4233.              <phone> is the phone number,
  4234.              <total> is the total number connected, an integer,
  4235.              <last> is the last logon date.
  4236.              Tailing spaces in each variables should have been
  4237.              discarded.
  4238.  
  4239. Return       <success> is FALSE if the phone directory cannot be open.
  4240.  
  4241. Caution      This procedure will close the formly opened file since the
  4242.              OPEN command is used. You should close the file before
  4243.              issuing this procedure and reopen the file after this
  4244.              procedure.
  4245.  
  4246. See also     PhoneDirectory, PhoneFind, PhoneRead, PhoneSize
  4247.  
  4248. Example
  4249.  
  4250.      PhoneRead 10,name,password,link,log,phone,total,last
  4251.      total = total+1     ; total is an integer variable
  4252.      DATE last           ; get today's date
  4253.      PhoneWrite 10,name,password,link,log,phone,total,last
  4254.  
  4255. TELEMATE SCRIPT                           APPENDIX A: ERROR MESSAGES    81
  4256.  
  4257.  
  4258. APPENDIX A: ERROR MESSAGES
  4259. ──────────────────────────────────────────────────────────────────────────
  4260.  
  4261. Compiler Error Messages
  4262. ──────────────────────────────────────────────────────────────────────────
  4263.  
  4264. 'CASE' expected
  4265.  
  4266. Declaration error
  4267.  
  4268.     A symbol is placed in wrong sequence the declaration part. You may
  4269.     have forgotten the comma between two variables.
  4270.  
  4271. 'ENDIF' expected
  4272. 'ENDPROC' expected
  4273. 'ENDSWITCH' expected
  4274. 'ENDWHILE' expected
  4275.  
  4276. Identifier expected
  4277.  
  4278.     An identifier was expected at this point. You may be trying to use a
  4279.     reserved word as an variable.
  4280.  
  4281. Invalid expression
  4282.  
  4283.     This symbol cannot participate in an expression in the way it does.
  4284.     You may have forgotten to write an operator between two operands.
  4285.  
  4286. Invalid option
  4287.  
  4288.     You have mistyped the option or forgotten the comma between the option
  4289.     and the value.
  4290.  
  4291. Invalid parameter
  4292.  
  4293.     Too many or too few parameter in calling a procedure.
  4294.  
  4295. Invalid sequence
  4296.  
  4297.     An unexpected symbol appears in a statement.
  4298.  
  4299. Invalid string operation
  4300.  
  4301.     An arithmetic operator is applied to string expression. To concat two
  4302.     strings, use the 'ConCat' function.
  4303.  
  4304. Misplacing Exit statement
  4305.  
  4306.     The EXIT can only be placed in WHILE and REPEAT loop. You may have put
  4307.     it outside a loop.
  4308.  
  4309.  
  4310. TELEMATE SCRIPT                           APPENDIX A: ERROR MESSAGES    82
  4311.  
  4312.  
  4313. New line expected
  4314.  
  4315.     Every statement should be in a line.
  4316.  
  4317. Nested too deep
  4318.  
  4319.     TMScript allows no more than 10 nested procedures.
  4320.  
  4321. Number out of range
  4322.  
  4323.     Integer must within the range from -2147483648 to 2147483647.
  4324.  
  4325. Numeric expression expected
  4326.  
  4327.     The preceding expression must be of integer type.
  4328.  
  4329. Program Incomplete - Unexpected end of file
  4330.  
  4331.     Your source file ends due to unbalanced begins and ends. Check the IF
  4332.     statement, SWITCH statement, WHILE loop, REPEAT loop and procedure
  4333.     definition.
  4334.  
  4335. Script file not found
  4336.  
  4337.     The include script of the #include directive does not exist. You may
  4338.     have forgotten the extension .SCR or not having the include script in
  4339.     the current directory.
  4340.  
  4341. String expression expected
  4342.  
  4343.     The preceding expression must be of string type.
  4344.  
  4345. String incomplete
  4346.  
  4347.     You have most likely forgotten the ending quote in a string constant.
  4348.  
  4349. Syntax error
  4350.  
  4351.     An illegal character was found in the source file. You may have
  4352.     forgotten the quotes around a string constant.
  4353.  
  4354. Too many include scripts
  4355.  
  4356.     TMScript allows no more than 10 nested include file.
  4357.  
  4358. Type mismatch
  4359.  
  4360.     This is due to incompatible types of the variable and the expression
  4361.     in an assignment statement or incompatible types of operands in an
  4362.     expression.
  4363.  
  4364.  
  4365. TELEMATE SCRIPT                           APPENDIX A: ERROR MESSAGES    83
  4366.  
  4367.  
  4368. 'UNTIL' expected
  4369. ',' expected
  4370. ':' expected
  4371. ')' expected
  4372. '=' expected
  4373. '"' expected
  4374.  
  4375.  
  4376. Runtime Error Messages
  4377. ──────────────────────────────────────────────────────────────────────────
  4378.  
  4379. Division by zero
  4380.  
  4381.     A number is divided by a expression of zero.
  4382.  
  4383. Invalid format in script file
  4384.  
  4385.     Make sure the .TMS file is a compiled script file. You should compile
  4386.     the script file using TMS.EXE. If you are using a newer version, you
  4387.     must delete the old .TMS files and re-compile it with the new TMS.EXE.
  4388.  
  4389. Out of memory
  4390.  
  4391.     This error occurs when TM.EXE is run out of memory and cannot allocate
  4392.     enough memory to the script file.
  4393.  
  4394. Stack overflow
  4395.  
  4396.     This error is reported on entry to a procedure when there is not
  4397.     enough stack space to allocate the procedure's local variables. Try to
  4398.     reduce the number of varibles or check for infinate recursive
  4399.     procedure.
  4400.  
  4401.  
  4402. TELEMATE SCRIPT                                                INDEX    84
  4403.  
  4404.  
  4405. INDEX
  4406. ──────────────────────────────────────────────────────────────────────────
  4407.  
  4408.     .SCR file, 1                       COM I/O, 24
  4409.     .TMS file, 1                       ComInCount, 30
  4410.                                        ComOutCount, 30
  4411.     A                                  Comment, 14
  4412.                                        Comparison, 12
  4413.     AddLineFeed, 52                    Comma, 54
  4414.     AddReturn, 52                      Compiling Script, 1
  4415.     Alarm, 27                          Compiler Error Message, 81
  4416.     AlarmSound, 52                     Computer, 54
  4417.     AlarmTime, 52                      Concat, 21
  4418.     AltKeys, 52                        ConfirmHangUp, 52
  4419.     ANSI, 54                           CONNECTED, 7, 33
  4420.     ANSI Color Code, 66                Connection, 52
  4421.     Append, 8, 27                      Console I/O, 24
  4422.     Arithmetic Operators, 11           Control Code, 3
  4423.     Assignment, 14                     ConvertDate, 75
  4424.     At, 28                             Create, 8, 31
  4425.     Atoi, 28                           Crlf, 54
  4426.     AutoRedial, 52
  4427.     AutoStop, 52                       D
  4428.     AutoWrap, 52
  4429.     Avatar, 54                         Data Type, 3
  4430.                                        Data, 52
  4431.     B                                  Date, 4, 31
  4432.                                        DateFormat, 53
  4433.     Background Color Code, 66          Delay, 32
  4434.     Baud, 52                           Delete, 8, 32
  4435.     Bell, 52                           DestBs, 53
  4436.     BIOS, 54                           Dial, 33
  4437.     Board, 45                          DialAttempt, 53
  4438.     Boolean, 4                         DialList, 53
  4439.     Boolean Operators, 12              DialPause, 53
  4440.     Built In Procedures, 24, 27        DialTime, 53
  4441.                                        DiffDate, 76
  4442.     C                                  DiffTime, 77
  4443.                                        DirEdit, 53
  4444.     Calling Procedure, 20              DirDownload, 53
  4445.     Capture, 52                        DirImage, 53
  4446.     Character, 3                       DirLog, 53
  4447.     CharPace, 52                       DirScript, 53
  4448.     ChDir, 8, 28                       DirTelemate, 53
  4449.     Clear COM, 29                      DirUpload, 53
  4450.     Clear Key, 29                      DirView, 53
  4451.     Clear Text, 30                     DirWrite, 53
  4452.     Close, 8, 30                       Dos, 33
  4453.     Color Code, 66                     Download, 48
  4454.     Color Value, 66
  4455.  
  4456.  
  4457. TELEMATE SCRIPT                                                INDEX    85
  4458.  
  4459.  
  4460.     E                                  H
  4461.  
  4462.     Echo, 66                           HangUp, 36
  4463.     EchoBkColor, 67                    Height, 10
  4464.     EchoBlink, 68
  4465.     EchoBlock, 68                      I
  4466.     EchoBox, 69
  4467.     EchoClearScreen, 69                If, 15
  4468.     EchoColor, 70                      Image, 36
  4469.     EchoGotoXY, 70                     Incoming, 53
  4470.     EchoHiLite, 70                     Include Directive, 18
  4471.     EchoNormal, 71                     Input, 37
  4472.     EchoReverse, 71                    InputCh, 37
  4473.     EchoInt, 66                        InputN, 73
  4474.     EchoToLocal, 66                    Integer, 3
  4475.     EchoToRemote, 66                   Isalpha, 74
  4476.     Else, 15                           Isalnum, 74
  4477.     ElseIf, 15                         Iscntl, 74
  4478.     EndIf, 15                          Isdigit, 75
  4479.     EndSwitch, 16                      Itoa, 38
  4480.     EndWhile, 17
  4481.     Error Messages, 81                 K
  4482.     Even, 54
  4483.     Exit, 18                           Keystroke, 38
  4484.     ExitTelemate, 34
  4485.     ExpandBlankLine, 53                L
  4486.     Expression, 11
  4487.     ExtAlarm, 53                       LastCall, 45
  4488.     ExtendedPacing, 53                 Length, 39
  4489.                                        LinePacing, 53
  4490.     F                                  LoadFon, 8, 39
  4491.                                        LoadKey, 8, 40
  4492.     FALSE, 4                           LoadMac, 8, 40
  4493.     File Handling, 26                  LoadPad, 9, 40
  4494.     FileExist, 35                      LocalEcho, 53
  4495.     FileSize, 8, 35                    LogFilter, 53
  4496.     Foregound Color Code, 66           Logging, 9, 41, 42
  4497.     Fossil, 54                         LogHeading, 53
  4498.     FOUND, 8, 25, 60                   LogOff, 41
  4499.                                        LogOn, 9, 41
  4500.     G                                  LogPause, 42
  4501.                                        LogResume, 42
  4502.     Get, 35
  4503.     GetCh, 36
  4504.     GetN, 72
  4505.     GuessFile, 53
  4506.     GuessInitial, 53
  4507.  
  4508.  
  4509. TELEMATE SCRIPT                                                INDEX    86
  4510.  
  4511.  
  4512.     M                                  Q
  4513.  
  4514.     Mark, 54                           Query, 45
  4515.     MaxDosShell, 53                    QuoteString, 54
  4516.     Memo, 45
  4517.     Miscellaneous Routines, 26         R
  4518.     Modem, 54
  4519.     MultiLine, 54                      Read, 9, 46
  4520.     Music, 54                          ReadCh, 9, 47
  4521.                                        ReadN, 73
  4522.     N                                  Receive, 9, 48
  4523.                                        Relational Operators, 12
  4524.     Nested Procedures, 22              Rename, 49
  4525.     None, 54                           Repeat, 17
  4526.                                        Return, 23
  4527.     O                                  RtsCts, 54
  4528.                                        Rule of Precedance, 11
  4529.     Odd, 54                            Running Script, 1
  4530.     Open, 9, 42                        Runtime Error Messages, 83
  4531.     Otherwise, 16
  4532.     Outgoing, 54                       S
  4533.  
  4534.     P                                  ScreenSaver, 54
  4535.                                        Script, 49
  4536.     PaceChar, 54                       ScriptEcho, 54
  4537.     Parity, 54                         Scope of Variables, 22
  4538.     Parameter Declaration, 20          Seek, 9, 50
  4539.     Parameter Passing, 20              Send, 9, 50
  4540.     Password, 45                       Set, 52
  4541.     Phone, 45                          Space, 54
  4542.     PhoneDirectory, 78                 Statement, 14
  4543.     PhoneFind, 78                      Stop, 45, 55
  4544.     PhoneRead, 79                      StrDel, 55
  4545.     PhoneSize, 79                      String, 3
  4546.     PhoneWrite, 80                     String Handling, 26
  4547.     Port, 54                           StrIns, 56
  4548.     Precedence, 11                     StripHighBit, 54
  4549.     Predefined Variables, 6            StrPos, 56
  4550.     Prefix, 54                         StrSet, 57
  4551.     Print, 24, 43                      SubStr, 57
  4552.     Printer, 54                        SUCCESS, 8
  4553.     Procedure Declaration, 19          Suffix, 54
  4554.     Procedure, 19                      SwapToDisk, 54
  4555.     Protocol, 48, 51                   SwapToEMS, 54
  4556.     Put, 25, 44                        Switch, 16
  4557.  
  4558.  
  4559. TELEMATE SCRIPT                                                INDEX    87
  4560.  
  4561.  
  4562.     T                                  W
  4563.  
  4564.     Tag, 54                            Waitfor, 2, 8, 25, 59
  4565.     Tell, 9, 58                        WaitUntil, 61
  4566.     Terminal, 54                       When, 61
  4567.     Time, 5, 58                        WhenIdle, 62
  4568.     Toolbox Procedures, 65             WhereX, 63
  4569.     Toolbox #1, 65                     WhereY, 63
  4570.     Toolbox #2, 72                     While, 17
  4571.     Toolbox #3, 75                     Width, 9
  4572.     Total, 45                          Write, 9, 63
  4573.     TRUE, 4
  4574.     TTY, 54                            X
  4575.  
  4576.     U                                  XonXoff, 54
  4577.  
  4578.     Until, 17                          Z
  4579.     Upload, 50
  4580.     Usage, 59                          zASCII, 54
  4581.     UsageLog, 54                       zAutoDownload, 54
  4582.     Using TMS.EXE, 1                   zRecovery, 54
  4583.  
  4584.     V
  4585.  
  4586.     Variable, 6
  4587.     Variable Identifier, 6
  4588.     Variable Declaration, 6
  4589.     VT52, 54
  4590.     VT102, 54
  4591.  
  4592.